# X (Twitter) Trends Scraper: 62 Countries, Hourly (`scrapemint/x-twitter-trends-scraper`) Actor

X (Twitter) trending topics for 62 countries and worldwide: the top 50 right now or any hour of the last 24, each trend's rank over the past 8 hours, new-entry flag, plus most-tweeted and longest-trending lists by day, week or month. $0.0002 per trend.

- **URL**: https://apify.com/scrapemint/x-twitter-trends-scraper.md
- **Developed by:** [Ken M](https://apify.com/scrapemint) (community)
- **Categories:** Social media, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 1,000 trends

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## X (Twitter) Trends Scraper: 62 Countries, Hourly

The **top 50 trending topics on X (Twitter)** for 62 countries and worldwide, as clean rows: rank, trend, hashtag flag, a ready X search link, and **each trend's rank over the past 8 hours**, so you can see what is climbing, what just entered and what is fading. Read the list **right now or any hour of the last 24**, and add the **most-tweeted** and **longest-trending** lists for the last day, week or month.

No X account, no API key, no proxy. $0.0002 per trend, no start fee.

### What you get per trend

- `rank` (1 to 50), `trend`, `isHashtag`, `xSearchUrl`
- `country`, `countrySlug`, `snapshot` ("now", "6 hours ago"), `hoursAgo`
- `rankHistory8h`: rank in each of the last 8 hours, oldest first (`null` = not in the top 50 that hour)
- `hoursInTop50Last8h`, `bestRankLast8h`, `isNew` (entered the top 50 this hour)
- `sourceUrl`, `scrapedAt`

With **Add most-tweeted and longest-trending lists** on, each country also gets:

- `list: mostTweeted_day|week|month` rows with `tweetScore` (relative tweet volume) and `recordDate`
- `list: longestTrending_day|week|month` rows with `hoursTrending`

### Countries

Worldwide, Algeria, Argentina, Australia, Austria, Bahrain, Belarus, Belgium, Brazil, Canada, Chile, Colombia, Denmark, Dominican Republic, Ecuador, Egypt, France, Germany, Ghana, Greece, Guatemala, India, Indonesia, Ireland, Israel, Italy, Japan, Jordan, Kenya, Korea, Kuwait, Latvia, Lebanon, Malaysia, Mexico, Netherlands, New Zealand, Nigeria, Norway, Oman, Pakistan, Panama, Peru, Philippines, Poland, Portugal, Puerto Rico, Qatar, Russia, Saudi Arabia, Singapore, South Africa, Spain, Sweden, Switzerland, Thailand, Turkey, Ukraine, United Arab Emirates, United Kingdom, United States, Venezuela, Vietnam. Use `all` for every one.

### Example input

The US and worldwide top 50 right now:

```json
{
  "countries": ["united-states", "worldwide"]
}
```

Four snapshots across the day for the UK and Germany, plus the week's most-tweeted and longest-trending:

```json
{
  "countries": ["uk", "germany"],
  "hoursAgo": ["0", "6", "12", "18"],
  "includeTopLists": true,
  "topListPeriod": "week"
}
```

Top 10 in every country (630 rows, about $0.13):

```json
{
  "countries": ["all"],
  "maxTrendsPerList": 10
}
```

### Example output

```json
{
  "list": "top50",
  "rank": 3,
  "trend": "Jerry",
  "isHashtag": false,
  "xSearchUrl": "https://x.com/search?q=Jerry&src=trend_click",
  "country": "United States",
  "snapshot": "now",
  "rankHistory8h": [null, null, null, 4, 5, 5, 3, 3],
  "hoursInTop50Last8h": 5,
  "bestRankLast8h": 3,
  "isNew": false
}
```

```json
{
  "list": "mostTweeted_week",
  "rank": 1,
  "trend": "#FUNToken",
  "isHashtag": true,
  "country": "United States",
  "tweetScore": 685,
  "recordDate": "20 hours ago"
}
```

### Uses

- **Social media and newsrooms:** what to post about now, per market, on a schedule every hour
- **Brand monitoring:** catch your brand, product or campaign hashtag entering a country's trends
- **Trend research:** a time series of what trended where, built from hourly runs
- **Marketing and ad teams:** pick hashtags that are rising, not ones already fading
- **Data and AI pipelines:** a clean daily feed of world events by country

### Pricing

- **$0.0002** per trend row
- No start fee. A country that fails is free.

### Notes

- X stopped publishing tweet counts outside its paid API, so no free source shows a "tweets" number any more. `tweetScore` is the source site's relative volume index, useful for ranking, not an exact count.
- Rank history is read from the source site's hourly chart, so a value can be off by one place.
- Trends are the country-level lists X publishes; city-level lists are not available from this source.
- Schedule the actor hourly (Apify Schedules) to build your own long-term trend history.

# Actor input Schema

## `countries` (type: `array`):

Countries to read, by name or slug: united-states, united-kingdom, japan, worldwide... Use all for every one of the 62 locations. Common short forms work (us, uk, uae).

## `hoursAgo` (type: `array`):

Which hourly snapshots to read: 0 is now, 1 to 23 are that many hours ago. E.g. 0, 6, 12, 18 for four snapshots across the day.

## `maxTrendsPerList` (type: `integer`):

Top N trends kept from each list, 1 to 50.

## `includeTopLists` (type: `boolean`):

Also read, per country, the trends with the highest tweet score and those that trended the most hours over the chosen period.

## `topListPeriod` (type: `string`):

Time window for the most-tweeted and longest-trending lists.

## Actor input object example

```json
{
  "countries": [
    "united-states",
    "worldwide"
  ],
  "hoursAgo": [
    "0"
  ],
  "maxTrendsPerList": 50,
  "includeTopLists": false,
  "topListPeriod": "day"
}
```

# Actor output Schema

## `trends` (type: `string`):

Rank, trend, hashtag flag, X search link, country, snapshot hour, 8-hour rank history, and tweet score or hours trending for the top lists.

## `summary` (type: `string`):

Trend counts per country and list, and any that failed.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "countries": [
        "united-states",
        "worldwide"
    ],
    "hoursAgo": [
        "0"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapemint/x-twitter-trends-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "countries": [
        "united-states",
        "worldwide",
    ],
    "hoursAgo": ["0"],
}

# Run the Actor and wait for it to finish
run = client.actor("scrapemint/x-twitter-trends-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "countries": [
    "united-states",
    "worldwide"
  ],
  "hoursAgo": [
    "0"
  ]
}' |
apify call scrapemint/x-twitter-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapemint/x-twitter-trends-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/gCj6pX8fBcVP8ySvH/builds/iLo1ePOlbWXh4rbAt/openapi.json
