May 2019
Beginner
528 pages
29h 51m
English
If a topic “goes viral,” you could have thousands or even millions of people tweeting about it at once. Twitter refers to these as trending topics and maintains lists of the trending topics worldwide. Via the Twitter Trends API, you can get lists of locations with trending topics and lists of the top 50 trending topics for each location.
The Tweepy API’s trends_available method calls the Twitter API’s trends/available19 method to get a list of all locations for which Twitter has trending topics. Method trends_available returns a list of dictionaries representing these locations. When we executed this code, there were 467 locations with trending topics:
Read now
Unlock full access