Overview
Trends show what topics are currently popular on Twitter. You can retrieve global trends, location-specific trends, and categorized trends (news, sports, entertainment). This is useful for content discovery, monitoring viral topics, or analyzing social media trends.Trend Class
Represents a trending topic on Twitter.Attributes
The name of the trending topic or hashtag.
The number of tweets associated with this trend (may be
None).The context or domain associated with the trend (e.g., “Politics”, “Sports”).
A list of related trend names grouped under this main trend.
PlaceTrend Class
Represents a trend for a specific geographic location.Attributes
The name of the trend.
The URL to view this trend on Twitter.
The search query string for this trend.
The volume of tweets about this trend.
Whether this is promoted content (always
None for organic trends).Location Class
Represents a geographic location where trends are available.Attributes
The Yahoo! Where On Earth ID for this location.
The name of the location (e.g., “New York”, “London”).
The country name.
The two-letter country code (e.g., “US”, “GB”).
The WOEID of the parent location.
Information about the place type.
The URL for this location’s trends.
Methods
get_trends()
Retrieves trending topics for this location.PlaceTrends - Dictionary containing trends and metadata.
Retrieving Trends
Client.get_trends()
Retrieve trending topics by category.The category of trends to retrieve:
'trending'- General trending topics'for-you'- Personalized trends based on your interests'news'- News-related trends'sports'- Sports-related trends'entertainment'- Entertainment-related trends
The number of trends to retrieve.
If no trends are fetched, continuously retry until trends are retrieved.
Additional parameters to add to the API request. Often used as
{'candidate_source': 'trends'} when the default doesn’t work.list[Trend] - A list of Trend objects.
Client.get_place_trends()
Retrieve the top 50 trending topics for a specific location.The Yahoo! Where On Earth ID of the location. Get available WOEIDs using
get_available_locations().PlaceTrends - Dictionary containing:
trends(list[PlaceTrend]): List of trending topicsas_of(str): Timestamp when trends were capturedcreated_at(str): When the trend data was createdlocations(dict): Location information
Client.get_available_locations()
Retrieve all locations where trends are available.list[Location] - A list of Location objects.
Usage Examples
Viewing Trending Topics
Location-Based Trends
Searching Trending Topics
Tracking Trends Over Time
Finding Tweet Volume
Analyzing Trend Context
Creating a Trend Dashboard
Notes
The
'for-you' category returns personalized trends based on your account’s interests and activity.WOEIDs (Where On Earth IDs) are Yahoo’s geographic identifiers. WOEID
1 represents worldwide trends.Not all trends include tweet volume counts. This data is often available for place trends but not for category trends.
Common WOEIDs
| Location | WOEID |
|---|---|
| Worldwide | 1 |
| United States | 23424977 |
| United Kingdom | 23424975 |
| New York | 2459115 |
| London | 44418 |
| Tokyo | 1118370 |
| Paris | 615702 |
| Los Angeles | 2442047 |
