We need to do the below steps:
- Set up a Twitter account if you do not have one already
- Using the Twitter account, we need to apply for a Developer Account first. The Link is here.
- We need to fill in some basic details like the reason to create a developer account or how we plan to use the Twitter API etc.
- After filling in the details, we need to accept the Developer Agreement and verify the email address.
- Once all the details are filled in, a notification will pop up something like below:
- Login to Twitter Developer Account
- Click on “Your name” on the right side top
- Click on "Apps”
- Click on "Create an App"
- Fill in App name and other details and click "Create"
- Once the APP is created the keys and he tokens o access Twitter will be generated
3. Install Libraries
Install the Tweepy and Twitter packages.
Now, we are ready to begin querying Twitter to see what we can learn from tweets! So, let's be clear about what are we trying to do in this post. If we open Twitter and search for some topic, we see all the tweets below. We want to achieve the same results by writing a few lines of python code. Then, in the next post, we can work on Sentiment Analysis and dig further.
I log in to Twitter and did an advanced search with words like "#corona" and language "English" and days from "01-Jan-2020". in the search bar, it is searching for "#corona lang:en since:2020-01-01"
Let's take a look at my first tweet result:
Let's start coding and see if we can get the same result.
Yes, I got it! If I take a look at my output, the first tweet is from Scott Ford wishing "Happy Birthday"!
So, now we know how to search for tweets the way we do on twitter. Let's collect these tweets from twitter and do some Text Analysis and then finally work on Sentiment Analysis.
No comments:
Post a Comment