100 Scripts in 30 Days challenge: Script 18,19,20 — Getting trending topics on Twitter using Tweepy

DailyPriyab
gopy
Published in
1 min readApr 25, 2017

100 Scripts in 30 Days challenge: Script 18,19,20 — Getting trending topics on Twitter using Tweepy

The below scripts help in getting the details of geographies for which Trending Topics are present, the closest geography for which trending topic is available and the trending topics for a location.

script_18_twitter_trending_available.py — Script helps in providing the list of all geographies with names and location ids for which it has trending topics.

script_19_twitter_trending_closest.py — Given a place name using geocoder API, it will find the closest location for the Geo location and will try to provide the details of the location from Twitter API for which Trending topics are present.

script_20_twitter_trending.py — For a location, it finds the Geo Location of the place closest for which the Trending topics present in Twitter for that location. Then it gives the top trending topics for that location and in the info about how many Tweets are there for that topic.

Twitter documentation:

The code is given below:

--

--

DailyPriyab
gopy
Editor for

Data Engineering | Data Governance | Azure | Spark | Python | Manager