Python Twitter bot part 6

Python Twitter bot part 6

                                          Python Twitter Bot Part 6

Hey guys, Welcome to the part 6 of twitter bot. In the previous article we have learnt how to create the follow back followers twitter bot. In this article, we will learn how to build an auto like twitter bot. With the help of this bot, we can search all the tweets containing a particular string and automatically like them. Here, we have to assign that string to the bot and also we have to pre-define the number of tweets, the bot have to search and like.

Code of Auto like twitter bot:

import tweepy
#enter your keys here
#enter your keys here
#to establish connection
#assigned our twitter home timeline
information to the variable public_tweets.
search_string="VARUN DEEPAK" #String you want to search
15 #number of tweets you want to like
for tweet in tweepy.Cursor(,search_string).items(numberoftweets):
" I liked the tweet") #print statement for us to know that bot has liked the
tweets successfully
except tweepy.TweepError as e:
#exception of tweep error and also prints the error reason
except StopIteration:
break #exception for iteration error and breaks the iteration

In the above code, the bot searches for the tweets containing the word "VARUN DEEPAK" and likes them but it only likes 15 tweets containing that word as we have mentioned in the code.

We will learn about Retweet twitter bot in the next article.