As a QA automation developer, I would have changed a couple of things. The time sleep will make you wait for nothing and get into synchronization issues. Instead, wait for a specific element to appear in the DOM before processing further. For the Infinity scrolling, instead of injecting JavaScript, you can do it in a pythonic way by checking for the line_height of the document. This way you can control your scroll and know you are at the true bottom of the document. So for each scroll compare line_height with new_height and loop it. Aside of that, great tutorial and basics!
Hey Ed! I'm new to python and everything you made is helping me SO MUCH. One of the biggest nightmare as a beginner is to have all the tools but not the balls nor the knownledge to do it. Everything seems easy or doable with you. Thanks again!
Instead of using static sleeps, you can use the functions selenium provides that checks for the presence of an element. As a result, it will be compatible with all Internet speeds.
edilgin I don't do python but it's somewhat the same. driver. wait(condition) Import this from selenium.webdriver.support import expected_conditions as ec Then do like ec.visibility_of_element_located(element) as the condition. Just google the function for a full on example. Pretty straightforward
Really great stuff! Just a word of warning: Twitter prohibits automated likes. I saw this video and decided to try to tackle this myself using their API. After setting up a Developer account, I stumbled upon the automation rules which state: "You may not like Tweets in an automated manner. " As a result, something like this may get you banned. Really cool regardless! Awesome video and nice work.
Thanks for this tut, really helpful. It's great that you keep some place for refactoring to helping our minds think about it. The simplest approach for not checking login and password fields would be opening incognito window.
make sure you handle already liked tweets. The problem is that after the scroll if the already liked tweet is still "visible" then clicking on it will unlike it. You probably need to maintain some kind of a data structure where you track already liked tweets. Great tutorial!
Hi Ed, you are my favourite developer on RUclips, You help me learn JavaScript 5 months ago with your weather app tutorial And now I'm learning python. Thanks Ed. Dimitri Marco 💪
Just watched your first video, excellent explaination but mainly you are relating python with real world application thanks buddy keep up waiting for more videos!!
oh i think god loves me cuz the whole last week i was exploring about bot's and how to create one with python and all tutorial was old and i found one posted by john g fisher it was instagram bot but unfortunly instagram stopped the automation thing so people who was using bots got blocked from follownig or liking or commenting so yeah and you just dropped this fresh one , thanks alot man edit after an hour: finished and it works perfectly and i used Chrome insted of firefox , thanks ed , please make more like this
Indentation matters, look at the for construction from line 35-41. This lives inside the "for i in range(1,3)" construction on line 29, meaning this code will be running three times. Un-indent this block (lines 35-41) one level and this code will only run once, when you have scrolled down three times. It is one of the love/hate aspects of Python, it forces you to indent your code but it is also really easy to make such mistakes. I really enjoy your tutorials, clear and to the point :-)
you are great ,,, I appreciate your videos a lot because you implement some real world Ideas rather than just teaching some basic stuff regarding how to code and syntax regarding things ..... Huge Love and respect from Pakistan ,.....
People who are having trouble with not finding perma-link. I suggest using xpath for automatically clicking on likes rather than fetching tweets then fetching links then liking.
I think it does not work with new twitter.. I try to find and just found tag and then I don't know...why there is no link/path to tweet status at all? Why does it change so fast? I'm sorry I not really expert in web tech..
I think this is outdated , considering the fact that the tutorial doesn't serve its purpose as twitter has changed the html and css... But to learn a lot of python stuff and as an introduction to selenium module, this is really helpful !
It is really good for understanding the basics, as for Twitter or any big websites they would do anything to eliminate chances of bot manipulation so its obvious that they will do changes (or sometimes just UI changes), anyhow with this vid you can still manage to the same with just a bit of extra imagination
instead of using selenium (which is slow and is just a bad idea xd) just use requests and parse the pages. If you really want to keep selenium then use chrome (it is way faster) and use --headless
Ed, bro can you help me? I try make fb bot but after 2-3login on my account i get verification alert and i have to guess users etc so what do u recommend to use as proxy using nodejs and phantomjs/others packages. Please god help
Pretty sure there is a much faster method than making a bot. I would personally use GET request to get html code. Then parse the code. Then use POST request to like a post. Pretty sure it would work at least 10 times faster.
@@asish-5848 first of all, I use C# but I am pretty sure Python has httpclient library as well. Make sure you know the basics of your programming language so you can make your own algorithms. After that make sure you know html because you will be parsing the html code. Than start googling how to retreive html code from a website and learn how to send GET and POST requests to a website. You use GET request to get html code from a website. You put it in a string form and then parse the info you need (you need html knowledge for that). Next, you want to send POST requests to website based on info you got from parsing the html code. POST request is used for filling text boxes, pressing buttond, etc. You will need POST request to fill in your name and password, for searching tweets and for liking them. I haven't done it before but theory it should work. If you are a beginner, I wouldn't suggest doing it this way because you may face some security protocols which you would need to find a way how to bypass them.
Hey, here is the solution write the name with capital "K" after import seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html
I had the same problem and it took me days to find a working solution. I asked a question here and no one helped. To find the tweets, I had to use find_elements_by_xpath instead of find_elements_by_class_name. So that looked like this: tweets = bot.find_elements_by_xpath("//*[contains(@class,'css-1dbjc4n r-18u37iz r-thb0q2')]") I have no idea why I had to use xpath but no one will answer me. Then to find the links in the tweets I did this: links = [] for tweet in tweets: elements = tweet.find_elements_by_tag_name("a") for elem in elements: links.append(elem.get_attribute("href")) For some reason, finding elements by class name doesn't work. Also, I don't know if this makes a difference but instead of using Firefox, I used Chrome.
Still have an issue with the code. The Chrome browser is opening the wrong urls. The url is some how entered wrong. For example: twitter.comhttps//twitter.com/hashtag/PositiveVibes?src=hashtag_click that's how the url looks .... This is going to take me a month to figure out smh. I'm about to just quit. This is too much for me.
@@youtubenewsfeed5427 Great answer!! I got some issues too, but I'll keep trying. Thanks for your help, I have not finished it but with your help, I'm a little bit closer. Thanks a lot!!
Juan No prob. I took a break. Might get back to it in a few. I figured out the url issue. But it’s not liking the tweets. Maybe I chose the wrong like class, idk... I’ll get back to it. I’m completely new to programming and it’s busting my brain.
@@youtubenewsfeed5427 i figured out everything except the like thing tried searching the button elements and choosing the 3rd, using the keyboard shortcut by sending the key "L" for like and still nothing works
@Dev Ed looks like it doesnt work in the new version of twitter because the class names are from css and they are different names and there are no id tags and stuff. I have reached till searching and scrolling and then had to give up beacause it was with css and not names. Please could you help me get through and give a solution how I should write my class name and how to get all the data-permalink-path. Thank you for your help.
7:11 Ed, now what if my internet is slow, and it execute the stuff but the page isn't ready? Edit: 8:34 you said add more time.sleep() but that seems inefficient, is there a better way?
There's a problem! After 1 iteration of Liking, the page will be at the tweet and not the hashtag page. Hence the scrollTo won't work and fetch more tweets! Second, even if you scroll down, it doesn't ignore the elements using class-name(tweet) from the last scroll. Hence in the next scroll, the elements which were already liked will still come in the list, and if HeartAnimation class exists on the button, the tweet will be unliked, and if not - 1 min sleep as per your code! I have thought about a solution for this. First scroll as many times you want on the hashtag page, the use the tweet class-name element selector to extract tweets at once. Then filter the liked tweets - (every tweet has a previous sibling of this []. If the tweet is liked, there is no content in this span, but if it is not liked there is "::before" in the span content). Now iterate the tweets on a random ranged number between (7-15 sec, before or after liking - doesn't matter) and like the tweet. This will keep the spam bot away. Secondly, if possible, don't directly visit the pages by GET but rather by clicking on the Tweet, to keep the bot from detecting organic reach through direct URL, which is suspicious when visiting URLs one after other. Bots most probably will ignore you if you click on tweets on the page directly keeping you away from Twitter Analytics. I'm writing this much coz people might lose access to their Accounts and/or get Banned on their authentic accounts by Twitter Team for Spam Botting on these accounts.
When I try to get the data permalink paths, I can't seem to find it in the inspector, and when I run the code I only get 2 empty brackets ( [] [] ) what could I be doing wrong?
Katalon is another tool for web-based apps -- for automation. But it is nice to see that it can be done in any IDE. I am a beginner in python (never programmed anything, beside the microwave for popcorn :) ) so my knowledge is minimal. I will most certainly do your example. Cheers!
def like_tweet(self,hastag): bot = self.bot bot.get('twitter.com/search?q='+hastag+'&src=typed_query') time.sleep(3) for i in range(1,3): bot.execute_script('window.scrollTo(0,document.body.scrollHeight)') time.sleep(3) tweetLinks = [i.get_attribute('href') for i in bot.find_elements_by_xpath("//a[@dir='auto']")] filteredLinks = list(filter(lambda x: 'status' in x,tweetLinks)) print(filteredLinks) for link in filteredLinks : bot.get(link) time.sleep(5) try: bot.find_element_by_xpath("//div[@data-testid='like']").click() time.sleep(10) except Exception as ex : time.sleep(10)
I have followed this tutorial and it has been perfect so far. My main concern is that with the new Twitter Update its difficult to locate classes and everything as unlike in tutorial like data-permalink-path and everything else is now RANDOM texts and digits making it difficult to understand. Moreover i am not able to retrieve the output of print(links) as in tutorial and i think so that is because of new update. Please help
Change it to name instead of class name like this : username = bot.find_element_by_name("session[username_or_email]") password = bot.find_element_by_name("session[password]")
I was also following this tutorial but, Twitter has changed a lot since the time of the video. The class names are different as well as the tweet links.
Can't get it to login. The homepage is different so I changed he opening to twitter.com/login but it just opens firefox and leaves them blank like it can't find the boxes even though the names look the same in the console.
I had the same issue. Your firefox browser is not compatible with the selenium version you have installed..try using firefox 62.0 With senenium version 3.141
For those who got the error saying nonInteractableElement try to use : email = bot.find_element_by_class_name("js-username-field") password = bot.find_element_by_class_name("js-password-field") worked for me
@Dominic Easton so I sat here for about 2 hours literally tried everything. Well, I guess the class names aren't the problem, it's just like the 'data-permalink-path' doesn't exist anymore. I don't know where, but they are somewhere. just can't find them.
Doesn’t work with the latest twitter update. The class name is not “tweet” any more. It’s dynamic naming of classes. Is there any way to use with after the latest update ?
Wow....its really great ....just wondering if one could use it to get turns of views on youtube....one just need lots of email accounts and the power of python
hi ! thanks you so much to improve our skills, i was wondering if it was possible to do the retweet in the same 'try' function, i've seen that there's 2 part before the retweet we must click on 2 btn but i can't found the class for it. thanks for helping :) luv yall
I get this error when I pip install selenium: pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + pip install selenium + ~~~ + CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException please help me xD
Don't run pip whilst in the Python interpreter; it is its own command from whatever Terminal. However, running python -m pip install ... could be needed depending on system.
I have a video idea for you, is it possible to build an app that helps travel addicts to find the cheapest flights everywhere in the world and track those prices / email the user when something drops below a certain $ ?
As I have social media allergy and don't care for it, I just wonder how this would get you, followers. Is it just hoping for some reciprocal love after the bot clicks the heart/like button?
Hey, I had made this bot a week ago it was pretty much working . Now I tried to run the code again but the thing is my links list is coming up to be empty I tried to recheck the elements for updates and I couldn't find the class tweets and the class Data-permalink-path Can you please help me about rectifying the code
@@goatedggwp It wont work anymore as twitter has had a update and changed the way the tweets work. The tweets now have a random id so this bot is not possible to make anymore
As a QA automation developer, I would have changed a couple of things. The time sleep will make you wait for nothing and get into synchronization issues. Instead, wait for a specific element to appear in the DOM before processing further.
For the Infinity scrolling, instead of injecting JavaScript, you can do it in a pythonic way by checking for the line_height of the document. This way you can control your scroll and know you are at the true bottom of the document. So for each scroll compare line_height with new_height and loop it.
Aside of that, great tutorial and basics!
How would you code this? I want to implement what you're suggesting but don't know how (noob)
Hey Ed! I'm new to python and everything you made is helping me SO MUCH. One of the biggest nightmare as a beginner is to have all the tools but not the balls nor the knownledge to do it. Everything seems easy or doable with you. Thanks again!
Instead of using static sleeps, you can use the functions selenium provides that checks for the presence of an element. As a result, it will be compatible with all Internet speeds.
what is it called?
edilgin I don't do python but it's somewhat the same.
driver. wait(condition)
Import this
from selenium.webdriver.support import expected_conditions as ec
Then do like ec.visibility_of_element_located(element) as the condition.
Just google the function for a full on example. Pretty straightforward
@@Ownage4lif31 on Python I'm showing webdriver.implicity_wait() ... same thing?
Instead he should have used Twitter API with tweepy
@@piyush7119 but it's not cool
Really great stuff! Just a word of warning: Twitter prohibits automated likes.
I saw this video and decided to try to tackle this myself using their API. After setting up a Developer account, I stumbled upon the automation rules which state: "You may not like Tweets in an automated manner.
" As a result, something like this may get you banned.
Really cool regardless! Awesome video and nice work.
Just add random number interval
@@julianwidjaja4896 I don't think that would be enough to fool Twitter's bot stomping algorithms haha
Thanks for this tut, really helpful. It's great that you keep some place for refactoring to helping our minds think about it. The simplest approach for not checking login and password fields would be opening incognito window.
It really works. It's the first time I do something like this and I've done it. Thanks buddy, you're the best.
I think this is one of the best most underrated dev YT channel.
make sure you handle already liked tweets. The problem is that after the scroll if the already liked tweet is still "visible" then clicking on it will unlike it. You probably need to maintain some kind of a data structure where you track already liked tweets.
Great tutorial!
And the button will probably have some extra class if it's liked so you can check for that instead of storing every tweet
Hi Ed, you are my favourite developer on RUclips,
You help me learn JavaScript 5 months ago with your weather app tutorial
And now I'm learning python.
Thanks Ed.
Dimitri Marco 💪
python #1
I find your videos really enjoyable.It's probably not only thanks to your knowledge but your personality aswell. Keep it up, Ed!
I was more impressed by the magic trick lol. Cool video, I just subscribed!.
It just has a hole like key ring..nothing amusing
@@abishekrajpandey8691 Wow! I didn't know!
Pausing at 1:23 will reveal the trick 😁
@@markmuthii Oh yeah I see the hole at the top XD
@@abishekrajpandey8691 whole*
Just watched your first video, excellent explaination but mainly you are relating python with real world application thanks buddy keep up waiting for more videos!!
Pause at 1:23 and you can see the missing section in the left loop. Rip magic😢
PepeHands
oh i think god loves me cuz the whole last week i was exploring about bot's and how to create one with python and all tutorial was old and i found one posted by john g fisher it was instagram bot but unfortunly instagram stopped the automation thing so people who was using bots got blocked from follownig or liking or commenting so yeah and you just dropped this fresh one , thanks alot man
edit after an hour: finished and it works perfectly and i used Chrome insted of firefox , thanks ed , please make more like this
.
Wow amazing..i am a math teacher and u are the best explaining conceptionaly.i only got uses of classes,functions from u.thanks ..from sri lanaka
Indentation matters, look at the for construction from line 35-41. This lives inside the "for i in range(1,3)" construction on line 29, meaning this code will be running three times.
Un-indent this block (lines 35-41) one level and this code will only run once, when you have scrolled down three times.
It is one of the love/hate aspects of Python, it forces you to indent your code but it is also really easy to make such mistakes.
I really enjoy your tutorials, clear and to the point :-)
Ahhh! another day, another great video. Thank you :)
Dam fab man...So impressed by the simplicity of code and your humbleness
you are great ,,, I appreciate your videos a lot because you implement some real world Ideas rather than just teaching some basic stuff regarding how to code and syntax regarding things .....
Huge Love and respect from Pakistan ,.....
Thanks. Will definitely try this. Hoping to see more automation vids with Python in the future.
wow! This is just more than perfect, you are just on point
Thanks for your videos! You're already among my favorite dev channels, keep it up! :)
This bot won't work anymore with the new twitter update. They have changed it so that each "tweet's" class name is now a random set of characters
That's exactly what I found out.
Is there a way around it?
Same as facebook did so AdBlock can't identify the ads anymore.
@@patrykgunwo5145 You can try using "xpaths" in the selenium bot, not tried it yet but I am pretty sure it would work
Anyone found a solution to this?
Hi, I'm fascinated by your sense of humor. Great tuts... Please keep it coming.
Is this workable now? I think twitter has a new update which won't let this bot work.
People who are having trouble with not finding perma-link.
I suggest using xpath for automatically clicking on likes rather than fetching tweets then fetching links then liking.
Can you be more specific, please?? @Devashish Manna
Can you specify the xpath please ?
watching another video of yours and this bumps in....cheers.
The first tweet you seen is from Tamil Nadu, India 😍😍😍😍😍
Yes its tala ajith
Ayyyy Indian 😎
Dude you are awesome, not everyday we see people making stuffs using code. Thanks a lot for the video. Also if you are not too busy, keep it up. ☺
I think it does not work with new twitter.. I try to find and just found tag and then I don't know...why there is no link/path to tweet status at all? Why does it change so fast? I'm sorry I not really expert in web tech..
there is a link but the class actually messy
hi I need a bot developer. WhatsApp me +919785732768
Just lovely! I'm amazed! Thank you sir. Hope to see more from you
lmao one of my fav channels currently
There's knowledge & humour perfect
I think this is outdated , considering the fact that the tutorial doesn't serve its purpose as twitter has changed the html and css... But to learn a lot of python stuff and as an introduction to selenium module, this is really helpful !
It is really good for understanding the basics, as for Twitter or any big websites they would do anything to eliminate chances of bot manipulation so its obvious that they will do changes (or sometimes just UI changes), anyhow with this vid you can still manage to the same with just a bit of extra imagination
@@samds7789 And I did it !
@@jishnupramod2130 how did you get to like posts? im stuck there :C
instead of using selenium (which is slow and is just a bad idea xd) just use requests and parse the pages.
If you really want to keep selenium then use chrome (it is way faster) and use --headless
There is a library called tweepy which is just perfect for things like that
@@topsl69 Yeah but it is specific for Twitter, if you want to make a powerful "web bot" Requests is the best way to go
How to parse dynamic page without selenium?
Frist time i watched your whole video and i love it ... simple and clean ... keep it up. ❤️❤️❤️❤️
Can u do for instagram similar pls? Btw u helped me a lot for javascript :)
SHAGYY Instagram WILLban you, so be careful. As I recall, if a user likes more than 200post per day they get flagged
instagram stopped automation with last update so bot wont work you will instantly get blocked
@@freakinmonkey85 can do for loop i < 100
i made one
@@mohammedalzamil7191 let me see
Subscribed. Really loving your python project series.
Ed, bro can you help me? I try make fb bot but after 2-3login on my account i get verification alert and i have to guess users etc so what do u recommend to use as proxy using nodejs and phantomjs/others packages. Please god help
Pretty sure there is a much faster method than making a bot. I would personally use GET request to get html code. Then parse the code. Then use POST request to like a post. Pretty sure it would work at least 10 times faster.
can you describe me how it works ?..I am a beginner
@@asish-5848 first of all, I use C# but I am pretty sure Python has httpclient library as well. Make sure you know the basics of your programming language so you can make your own algorithms. After that make sure you know html because you will be parsing the html code. Than start googling how to retreive html code from a website and learn how to send GET and POST requests to a website. You use GET request to get html code from a website. You put it in a string form and then parse the info you need (you need html knowledge for that). Next, you want to send POST requests to website based on info you got from parsing the html code. POST request is used for filling text boxes, pressing buttond, etc. You will need POST request to fill in your name and password, for searching tweets and for liking them. I haven't done it before but theory it should work. If you are a beginner, I wouldn't suggest doing it this way because you may face some security protocols which you would need to find a way how to bypass them.
@@danieldragojevic3016 ok...i got 20-30% ...rest i will try... if you try it in future than do ping me !
I'm stuck here 18:09 can anyone help
I'm not able to find data permalink
Same...
Same here!!
Yup same here
same cant find tweet class and permalink
If I am correct they changed the Class Name for every tweet
+1 subscriber. This is the programmer I've been looking for a long time. Good job and keep it up!
it is showing error while running.
the error is " cannot import name 'keys' from 'selenium.webdriver.common.keys' " can you help me with this
Hey, here is the solution write the name with capital "K" after import seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html
@@lionelmouendou3057 Thanks a lot for posting!
@@lionelmouendou3057 Tahnks mate!
@@lionelmouendou3057 Thanks your answer helped me a lot
@@lionelmouendou3057 it still says ModuleNotFoundError no module named 'selenium.webdriver.common
Dude just got some hopes to get back into programming. Thank
You're awesome bro, love from India 🇮🇳
U.must be a very happy man..many of ur videos u laugh alot which is good
Whenever I try to do user.clear(), it shows an error saying nonInteractableElement. Anybody else facing it and how to resolve?
I used this before to automatically log in to my Instagram. Selenium is a pretty useful tool and I’m excited to try this out with a twitter bot!
same :D after i saw this i automated my ig account entrance
Great video!!!, but i can not find the link of the tweets, in fact is the class what i can't find ('tweet' and 'data-permanent-link'). Suggestions???
I had the same problem and it took me days to find a working solution. I asked a question here and no one helped. To find the tweets, I had to use find_elements_by_xpath instead of find_elements_by_class_name. So that looked like this: tweets = bot.find_elements_by_xpath("//*[contains(@class,'css-1dbjc4n r-18u37iz r-thb0q2')]") I have no idea why I had to use xpath but no one will answer me. Then to find the links in the tweets I did this: links = []
for tweet in tweets:
elements = tweet.find_elements_by_tag_name("a")
for elem in elements:
links.append(elem.get_attribute("href"))
For some reason, finding elements by class name doesn't work. Also, I don't know if this makes a difference but instead of using Firefox, I used Chrome.
Still have an issue with the code. The Chrome browser is opening the wrong urls. The url is some how entered wrong. For example: twitter.comhttps//twitter.com/hashtag/PositiveVibes?src=hashtag_click
that's how the url looks .... This is going to take me a month to figure out smh. I'm about to just quit. This is too much for me.
@@youtubenewsfeed5427 Great answer!! I got some issues too, but I'll keep trying. Thanks for your help, I have not finished it but with your help, I'm a little bit closer. Thanks a lot!!
Juan No prob. I took a break. Might get back to it in a few. I figured out the url issue. But it’s not liking the tweets. Maybe I chose the wrong like class, idk... I’ll get back to it. I’m completely new to programming and it’s busting my brain.
@@youtubenewsfeed5427 i figured out everything except the like thing tried searching the button elements and choosing the 3rd, using the keyboard shortcut by sending the key "L" for like and still nothing works
incredible what you can do with python , do more videoss like this plz
@Dev Ed looks like it doesnt work in the new version of twitter because the class names are from css and they are different names and there are no id tags and stuff. I have reached till searching and scrolling and then had to give up beacause it was with css and not names. Please could you help me get through and give a solution how I should write my class name and how to get all the data-permalink-path. Thank you for your help.
Same here.
Same problem have you found a solution yet ?
After 22 mins I remembered, that I don't even use Twitter :D good content, keep going
7:11 Ed, now what if my internet is slow, and it execute the stuff but the page isn't ready?
Edit: 8:34 you said add more time.sleep() but that seems inefficient, is there a better way?
use explicit waits www.geeksforgeeks.org/explicit-waits-in-selenium-python/
Wowwww best twitter bot tutorial everrrrr!!!! Thank you!!!
Got this message:
ElementNotInteractableException: Message: Element could not be scrolled into view
What do I do?
same here
Same here
search for the element with xpath as because there might be more than one element with same name and those are not interact-able
Robbie Strandis go to sleep😂😂😂
@@debdutgoswami can you explain more?
I got the same message and i could not log in.
There's a problem! After 1 iteration of Liking, the page will be at the tweet and not the hashtag page. Hence the scrollTo won't work and fetch more tweets! Second, even if you scroll down, it doesn't ignore the elements using class-name(tweet) from the last scroll. Hence in the next scroll, the elements which were already liked will still come in the list, and if HeartAnimation class exists on the button, the tweet will be unliked, and if not - 1 min sleep as per your code! I have thought about a solution for this. First scroll as many times you want on the hashtag page, the use the tweet class-name element selector to extract tweets at once. Then filter the liked tweets - (every tweet has a previous sibling of this []. If the tweet is liked, there is no content in this span, but if it is not liked there is "::before" in the span content). Now iterate the tweets on a random ranged number between (7-15 sec, before or after liking - doesn't matter) and like the tweet. This will keep the spam bot away. Secondly, if possible, don't directly visit the pages by GET but rather by clicking on the Tweet, to keep the bot from detecting organic reach through direct URL, which is suspicious when visiting URLs one after other. Bots most probably will ignore you if you click on tweets on the page directly keeping you away from Twitter Analytics. I'm writing this much coz people might lose access to their Accounts and/or get Banned on their authentic accounts by Twitter Team for Spam Botting on these accounts.
When I try to get the data permalink paths, I can't seem to find it in the inspector, and when I run the code I only get 2 empty brackets ( [] [] ) what could I be doing wrong?
Same
I have the same problem, were you able to solve it yourself?
Katalon is another tool for web-based apps -- for automation. But it is nice to see that it can be done in any IDE. I am a beginner in python (never programmed anything, beside the microwave for popcorn :) ) so my knowledge is minimal.
I will most certainly do your example. Cheers!
pause at 1:23 u can see the hole in the ring.
its free real estate
Thank you soo much man!!!
I'm gonna do this for IG now!!!
print(links) -- prints empty [ ]
what to do?
im having the same problems
same problem. any solutions...
def like_tweet(self,hastag):
bot = self.bot
bot.get('twitter.com/search?q='+hastag+'&src=typed_query')
time.sleep(3)
for i in range(1,3):
bot.execute_script('window.scrollTo(0,document.body.scrollHeight)')
time.sleep(3)
tweetLinks = [i.get_attribute('href')
for i in bot.find_elements_by_xpath("//a[@dir='auto']")]
filteredLinks = list(filter(lambda x: 'status' in x,tweetLinks))
print(filteredLinks)
for link in filteredLinks :
bot.get(link)
time.sleep(5)
try:
bot.find_element_by_xpath("//div[@data-testid='like']").click()
time.sleep(10)
except Exception as ex :
time.sleep(10)
@@bragg02 it works like a charm! thank you @Bragg
@@bragg02 Thanks buddy... its working perfectly!
dude, you are making me love your videos with all this awesome knowledge and magic trics +follow
I have followed this tutorial and it has been perfect so far. My main concern is that with the new Twitter Update its difficult to locate classes and everything as unlike in tutorial like data-permalink-path and everything else is now RANDOM texts and digits making it difficult to understand. Moreover i am not able to retrieve the output of print(links) as in tutorial and i think so that is because of new update. Please help
Change it to name instead of class name like this :
username = bot.find_element_by_name("session[username_or_email]")
password = bot.find_element_by_name("session[password]")
@@Kay-xz5ru but how to do this with the tweets that previously was "data-permalink-path" ?
@@bschs I have not find a way
I was also following this tutorial but, Twitter has changed a lot since the time of the video. The class names are different as well as the tweet links.
OWS Optimum Wireless if enough people want it I can make an updated tutorial
I rewatched the magic several times and im still amazed with it everytime
18:22 hey can anyone help me, with the word *elem*(unresolved reference) ?
Love this tutorial. Thanks Dmitri!
Can't get it to login. The homepage is different so I changed he opening to twitter.com/login but it just opens firefox and leaves them blank like it can't find the boxes even though the names look the same in the console.
I had the same issue. Your firefox browser is not compatible with the selenium version you have installed..try using firefox 62.0 With senenium version 3.141
just use this email = bot.find_element_by_name('session[username_or_email]')
bot.get('twitter.com/login')
For those who got the error saying nonInteractableElement try to use : email = bot.find_element_by_class_name("js-username-field")
password = bot.find_element_by_class_name("js-password-field")
worked for me
yeah, it worked for me as well,
Thank you so much.
I've done magic in the past, great presentation. 😂
are you jewish?
This can also achive by using javascript only use console tab in the browser then do a logic code there.
Twitter recieved an update.. not working unfortunatly
@Dominic Easton yeah i tried It. Try it yourself and you will see It wont work
@Dominic Easton Okay, i'll try again. Hoping For the best
@Dominic Easton so I sat here for about 2 hours literally tried everything. Well, I guess the class names aren't the problem, it's just like the 'data-permalink-path' doesn't exist anymore. I don't know where, but they are somewhere. just can't find them.
@Dominic Easton yea but how we should use this shit
you are awesome love you bro. you are forcing me from web designer to coder :)
Nice video, but isn't the Twitter api made for things like that?
I have created a bot using the Twitter API, but it is more restrictive. This is quite a nice alternative method.
@@darrenlefcoe hi I need a bot developer. WhatsApp me +919785732768
i honestly like how you explain code .... you a bit funny .. that is good for learning .
Doesn’t work with the latest twitter update. The class name is not “tweet” any more. It’s dynamic naming of classes.
Is there any way to use with after the latest update ?
Same question is mine
Please someone help us...
The class name is just changed to "css-1dbjc4n" and not a random one.
1:23 pause and check the left ring(the part of ring close to his thumb), you will find the trick behind it. ;)
Call me hacker boiiii
I love your videos keep it up !
@@ascpixi you must be the life of the party everywhere xDD
There's no data-permalink-path any more
bro help please..data-permalink-path is not there! how to fix it?
twitter added are you a robot after login xdddd
One of the best tutorials!!! Tnx man
I’m only watching this because I’m interested in the code; like understanding how it functions
No one would really care if you were here for the Twitter bot bro.
Twitter changed the attributes on the tweets. All of the class names are randomized now and I cannot find that "data-permalink-path" attribute.
New version of Twitter GG
hi I need a bot developer. WhatsApp me +919785732768
According to Automated actions you take on Tweets or accounts: You may not like Tweets in an automated manner.
When I'm trying to print links
It's printing blank list
Please help me
Wow....its really great ....just wondering if one could use it to get turns of views on youtube....one just need lots of email accounts and the power of python
do some more stuff related to web using Python ...
Thanks in Advance
You're amazing bro, I just love your content
Too bad twitter removed "data-permalink", I don't know how else to catch tweets. Everything else works great, I learned a lot!
did u find an another way
Ye
@@pinkman9224 no
@@Galaxy_World they encrypted the class on public view :(
hi ! thanks you so much to improve our skills, i was wondering if it was possible to do the retweet in the same 'try' function, i've seen that there's 2 part before the retweet we must click on 2 btn but i can't found the class for it. thanks for helping :) luv yall
I get this error when I pip install selenium:
pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1
+ pip install selenium
+ ~~~
+ CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
please help me xD
Don't run pip whilst in the Python interpreter; it is its own command from whatever Terminal. However, running python -m pip install ... could be needed depending on system.
Ommg thats so awesome and you aint lonely you got loyal followers
Nothing happening after opening the login page
same thing happenning
increase time.sleep(60) suppose
I did not expect the magic rings but when you showed em i suddenly got interested
You've got to be Johny Depp's distant relative... 😂
Yea the beard is vaguely similar
I have a video idea for you, is it possible to build an app that helps travel addicts to find the cheapest flights everywhere in the world and track those prices / email the user when something drops below a certain $ ?
Hi, Edwin I like your videos. So upload to create an automatic Instagram followers bot in python.
u will get blocked
As I have social media allergy and don't care for it, I just wonder how this would get you, followers. Is it just hoping for some reciprocal love after the bot clicks the heart/like button?
Hello dev
I follow what you did...
but I still can't find tweet class in browser !!
I want it to show all links
Got you at 1:22 'there is an opening in one of the ring'
Why did you ask if we were lonely, we want to learn code of course we don't have friends lol
Thanks for these videos mahn
Hey, if you still have a problem with identifying elements,,, Use xpaths... they work. Happy coding!!
Hey, I had made this bot a week ago it was pretty much working . Now I tried to run the code again but the thing is my links list is coming up to be empty
I tried to recheck the elements for updates and I couldn't find the class tweets and the class Data-permalink-path
Can you please help me about rectifying the code
@@goatedggwp It wont work anymore as twitter has had a update and changed the way the tweets work. The tweets now have a random id so this bot is not possible to make anymore
@@HudZah any new ideas?
Love ya man!