Monitor trending topics globally and by location. Build trend dashboards, detect breaking news, and spot viral content early.
Sign up at scrapebadger.com and grab your API key.
Get the current trending topics across all of Twitter.
from scrapebadger import ScrapeBadger
sb = ScrapeBadger(api_key="YOUR_API_KEY")
trends = sb.twitter.trends.get(category="trending", count=20)
for t in trends["data"]:
print(f"{t['name']}: {t.get('tweet_volume', 'N/A')} tweets")Use WOEID codes to get trends for specific cities or countries.
# WOEID 23424977 = United States
us_trends = sb.twitter.trends.get_place("23424977")
# WOEID 2459115 = New York
ny_trends = sb.twitter.trends.get_place("2459115")
for t in us_trends["data"]:
print(f"US Trending: {t['name']}")Use the Geo Search endpoint to find WOEID codes for any location.
places = sb.twitter.geo.search(query="London")
for p in places["data"]:
print(f"{p['name']}: WOEID {p['woeid']}")Schedule periodic trend fetches to build a historical trend database.
import time
import json
from datetime import datetime
while True:
trends = sb.twitter.trends.get(category="trending")
snapshot = {
"timestamp": datetime.now().isoformat(),
"trends": trends["data"]
}
with open("trend_history.jsonl", "a") as f:
f.write(json.dumps(snapshot) + "\n")
print(f"Saved {len(trends['data'])} trends at {snapshot['timestamp']}")
time.sleep(300) # Every 5 minutesTwitter updates trending topics every few minutes. We recommend polling every 5-15 minutes for trend tracking.
Twitter supports trends for most countries and major cities. Use Geo Search to check if your target location has a WOEID.
Tweet volume is the approximate number of tweets using that trend in the last 24 hours. Not all trends have volume data.
Yes. Monitor for rapid changes in trending topics. A new trend appearing with high volume often indicates breaking news.
Use advanced search operators to find tweets by keyword, hashtag, author, date range, language, and more.
5 minutesLearn how to extract the complete follower list of any Twitter account with profile data, follower counts, and bios.
5 minutesSet up real-time monitoring for your brand on Twitter. Get instant webhook alerts when someone mentions your brand or products.
10 minutes