Hey guys, Welcome to the part 4 of twitter bot. I assume you have created your twitter account and twitter developer account and also learnt some basics on how to use twitter API from my previous articles. Now, let us move on to the interesting part i.e. how to print tweets from our twitter home timeline.
Code of Tweet printing twitter bot:
import tweepy auth=tweepy.OAuthHandler(consumer_key,consumer_secret)#enter your keys here auth.set_access_token(access_token,access_token_secret)#enter your keys here api=tweepy.API(auth)#to establish connection public_tweets=api.home_timeline()#assigned our twitter home timeline information to the variable public_tweets for tweet in public_tweets:#iterating through every tweet in our home timeline print(tweet.text)#prints all the text in our twitter account home timeline
Output:
In the above output we can see, tweets about the movie RRR and also tweets from the google and so on.
We will learn about Follow back followers twitter bot in the next article.
Comments