Skip to content

Returns a network of users a user is following on Twitter, for a specified amount of levels

License

Notifications You must be signed in to change notification settings

samuelberntzen/Twitter-following-network-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter-Friend-Network-Scrape

Returns users a user is following on Twitter, for a specified amount of levels. Running these functions requires the user to have access to a Twitter API tokens.

Make sure to add your own API keys as variables, as they are imported from my own text file, otherwise the code will not run.

The starting-user is changed by editing the user_id argument in line 81.

Due to API rate limits, the function acquires user_ids. However, the optional function acquires screen_name for each unique user_id acquired in the first function (this can take multiple days).

For reference, retrieving a follower network based on who @realDonaldTrump follows takes roughly 30-45 minutes, and retrieving their screen names takes several hours.

Keep in mind that if you do not run the get_screen_name.py, the data in relation_array will only contain users' ID- not their screen name.

A dataset is added as example, which contains @realDonalTrump's friends and their screen names.

About

Returns a network of users a user is following on Twitter, for a specified amount of levels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages