Skip to content

Python script that scrapes Twitter to find popular tweets with #Hero

Notifications You must be signed in to change notification settings

k-akervall/HeroOfTheWeek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Hero Of The Week

This Python script scrapes Twitter to find popular tweets using the hashtag Hero.

Each week I scrape 10,000 tweets and then apply a formula that weighs the retweet count at 40% and the like count at 60% and adds them in a combined score. Although many formulas could be used to ascertain the popularity of a tweet, I chose this simple formula as I felt it demonstrates that other both agree with the content and value it enought to replicate it on their own feed.

I used snscrape to do the scraping from Twitter since it allows me to go back and look at historical tweets and doesn't require an API.

I only scrape English language tweets because I initially found it was difficult for me to understand the content of tweets that were in other languages and determine who the 'hero' in the tweet was.

I take a sample of 10,000 tweets so that my script runs in a short amount of time, but I still have a large enough sample to gather tweets that are popular in various communities.

This is a simple exercise, but it is interesting to see the variety of results. From the everyday person (or thing!) to someone with celebrity status, heroes are found all around us for acts and qualities both large and small. It reflects the array of values found in our world.

Created by Kristin Akervall, 2022

Hero of the Week Results

Oct 7 – German shepherd from the UK named Finn, who saved “Dave” and was rewarded with a steak https://twitter.com/K9Finn/status/1577738525893705728

Oct 14 – It’s Finn again! https://twitter.com/K9Finn/status/1579026690818248704

Oct 21 – A Japanese band called INI at the 1Chance festival (has a song called ‘Hero’) https://twitter.com/official__INI/status/1581978340185063426

Oct 28 – Vending machine inside a video game https://twitter.com/PG_primegames/status/1584148727845244928

Nov 4 - Constable Ranvir Singh, who saved a passenger from falling in front of a train at the Pipariya railway station https://twitter.com/RPF_INDIA/status/1587727153038123009

Nov 11 – Kim Go Eun, Korean actress https://twitter.com/soompi/status/1590749979874033664

Nov 18 – Aalim Hakim, celebrity hairdresser in Mumbai https://twitter.com/AalimHakim/status/1591303737787973634

Nov 25 – Richard M. Fierro, army veteran who disarmed the Club Q gunman https://twitter.com/MuellerSheWrote/status/1594860433332215809

Dec 2 – Christian Pulisic, US football player who collided with Iranian goalie, but scored a goal in FIFA World Cup https://twitter.com/UncleChaps/status/1597676892928475137

Dec 9 – Metro Boomin, record producer and DJ https://twitter.com/MetroBoomin/status/1599886409888071680

Dec 16 – a spammy looking online game https://twitter.com/taskonxyz/status/1602587058396364800

Dec 23 – INI again with their ‘Hero’ song https://twitter.com/official__INI/status/1605246659553796096

Dec 30 – Florida Corporal Ray Hamilton, who was killed while responding to a domestic violence suspect https://twitter.com/protectingblue/status/1606838156418076673

Jan 7 - Iranian millitary leader General Soleimani https://twitter.com/fa_abv/status/1608538663234990081

About

Python script that scrapes Twitter to find popular tweets with #Hero

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published