Consumes Twitter sample stream to track the following:
- Total number of tweets received
- Average tweets per hour/minute/second
- Top emojis in tweets
- Percent of tweets that contains emojis
- Top hashtags
- Percent of tweets that contain a url
- Percent of tweets that contain a photo url (pic.twitter.com, pbs.twimg.com , or instagram)
- Top domains of urls in tweets
Exposes REST API to query this information
- Create Twitter app with Sampled Stream preview active.
- Set Twitter
CUSTOMER_KEY
andCUSTOMER_SECRET
environment variables. - Run
go run .
- Send HTTP GET to various endpoints:
- http://localhost:8080/info returns basic info in a JSON format.
Count
of tweets in database:Duration
from oldest tweet to newestRatePerSecond
of the average number of tweets received per secondPercentHashtag
,PercentURL
,PercentImageURL
,PercentEmoji
return the fraction of total tweets containing those items.
- http://localhost:8080/hashtags?count={n} returns the top
n
hashtags - http://localhost:8080/domains?count={n} returns the top
n
domains - http://localhost:8080/emoji?count={n} returns the top
n
emoji