Exercise 4: Twitter API Practice
Due: Wednesday, May 5th
Task: I would like you to query Twitter¡¯s API using a parameter from a get request with express. Then I would like you to analyze the users who match the search criteria. Please write all code in the implementation folder!
Part 1
In a file called TweetBot.js (starter code and guide here) I would like you to do the following:
¡ñ Using express, create a server that will read from the following URL: localhost:5000/api/tweets/XXX
¡ñ The XXX must be a parameter that will then be used as the search query for twitter.
¡ñ Using the ¡®search/tweets¡¯ get command discussed in lecture, find 50 tweets based on the
parameter from above and use those tweets to compile all text related to that query Example:
localhost:5000/api/tweets/fifa
¡ñ Searches and finds 50 tweets related to the keyword fifa localhost:5000/api/tweets/goats
¡ñ Searches twitter to find 50 tweets related to the greatest animal in the world
Part 2
In the sphere of marketing and data analytics in business, viewing interactions between a topic and the users that interact with them are invaluable. In this section, you will take a look at the users who match the search criteria.
How will we make requests?
In a file named TweetAnalysis.js we will use postman to make a GET request at localhost:2500/analysis with a raw JSON in the following format:
{
¡°search¡±: ¡°Testudo¡±
}
Use this to then query twitter using the same ¡®search/tweets¡¯ get command as part 1.
What will you do with the tweets that match the query?
For marketing reasons, I would like you to sift through the user attribute on the 100 tweets that match the query, then display the following data on the page:
1. Average age on the accounts displayed as ___Years, ___Months 2. Average follower count
3. Number of English language users
4. Number of Eastern Time (US & Canada) zone users
No need to make any CSS or formatting for this exercise, please just display the data by whatever means.