Skip to content

For writers, having an understanding of how a story is playing out can be crucial to creating meaningful content. Using the Twitter-API, content creaters can create a custom search that show which aspects of a story are the most pertinent.

License

Notifications You must be signed in to change notification settings

smandekar1/Twitter-API-Superbowl-Tweet-Analysis

Repository files navigation

Twitter API - Superbowl Tweet Analysis

License: MIT

For writers, having an understanding of how a story is playing out can be crucial to creating meaningful content. Using the Twitter-API, content creaters can create a custom search that show which aspects of a story are the most pertinent. Tweets are searched by topic or search term and tweets with a minimum number of likes (favorite_count) are included in the search results. This allows content creaters to quickly understand what topics audience members are most interested in at the time.

Search criteria also includes time parameters so that content creaters can view real time content and can create effective.

useful image

Searchterm: "Tom Brady", Timeframe: 1st hour of Superbowl game

Summary

The WordCloud library allows users to create generated word clouds as seen above. This particular cloud was generated by searching for "Tom Brady" in tweets tweeted during the Superbowl game itself. Using the Twitter-API, content creaters can create a custom search that show which aspects of a story are the most pertinent. Tweets are searched by topic or search term and tweets with a minimum number of likes (favorite_count) are included in the search results. This allows content creaters to quickly understand what topics audience members are most interested in at the time. The WordCloud library also allows users to fit words into a graphical outline image (above).

Using WordCloud Graphic Images

The outline image is generated automatically from an uploaded image. To create an effective word cloud, it is best to use an image that has a strong border around it. If there is not a strong border between the image and the background, words can “leak out” into the rest of the page. This was observed several times with different graphic images. Included here as another example using Alice in Wonderland as a background image.

useful image

Other Notes

Even with tools like Stopwords, a good amount of old fashion editing was still required. Spanish words krept in to the list and those needed to be taken out or added to the stopwords list. I chose to remove curse words from the wordcloud, but other users may find those four letter words very relevant to the story.

Requirements

Twitter API - with credentials
matplotlib==3.0.2
numpy==1.16.1
pandas==0.24.1
Pillow==5.4.1
searchtweets==1.7.4
stop-words==2018.7.23
tweet-parser==1.13.1
wordcloud==1.5.0

Matplotlib

A graph of most common words from tweets

useful image

some of the most common words from superbows tweets - oddball terms removed

Sample tweets returned while Superbowl was being play

RT @SJPeace: I heard the #SuperBowl is coming up.

3 of them killed 30 people. 3 of them killed no one. Look at the differences in the…Sun Feb 03 02:59:09 +0000 2019favorite_count: 26301

RT @SJPeace: I heard the #SuperBowl is coming up.

3 of them killed 30 people. 3 of them killed no one. Look at the differences in the…Sun Feb 03 02:59:09 +0000 2019favorite_count: 26301

RT @myserenity69: It's on #SuperBowl Sunday once a year..

BUT RACISM IS A DAILY REALITY.

Remember to #TakeAKnee

BlackLivesMatter #No…Sun Feb 03 02:59:10 +0000 2019favorite_count: 491

RT @tribranchvo: straight men: are you watching the superbowl this weekend?

me: https://t.co/yvSPyJu87gSun Feb 03 02:59:10 +0000 2019favorite_count: 32199

RT @SJPeace: I heard the #SuperBowl is coming up.

About

For writers, having an understanding of how a story is playing out can be crucial to creating meaningful content. Using the Twitter-API, content creaters can create a custom search that show which aspects of a story are the most pertinent.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published