Member-only story
Python — How to Extract Tweets from Twitter
If you are working as Python developer and you have to extract tweets from Twitter for any specific hashtag then there are a lot of libraries which help us to accomplish this task.
Step 1 — How do we get a Twitter Consumer Key and Consumer Secret key?
First of all, we have to create a Twitter account and get the necessary credentials on the Twitter developer platform to access the Twitter API by following these steps:
- Go to https://dev.twitter.com/apps/new and log in, if necessary
- Supply the necessary required fields, accept the Terms Of Service, and solve the CAPTCHA.
- Submit the form
- Go to the API Keys tab, there we will find our Consumer key and Consumer secret keys.
Step 2 — How do we connect to the Twitter API
Now that we are ready with the Twitter credentials required, let’s move on to the next stage, which is data extraction. We are using tweepy library to extract the tweets. If you don’t have this library then you can install it by using pip…