# X (Twitter) Trends Scraper: Trends by Country & Category (`memo23/x-twitter-trends-scraper`) Actor

Get the current trending topics and hashtags on X (Twitter) for 58 countries: rank, trend name, topic category such as Technology, Sports or Politics, and a search link. Pick countries or all of them, filter by category or hashtags. No login. $0.15 per 1,000 trends.

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

## Pricing

from $0.15 / 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: Trending Topics by Country with Categories

Get what is **trending on X (Twitter) right now in 58 countries**, without an account or API key. Every row gives the **rank, the trend name, its topic category** (such as Technology, Sports, NFL, Politics or Entertainment, when X shows one), whether it is a hashtag, and a ready **search link**. Pick a few countries or all 58, and keep only the categories you care about. **$0.15 per 1,000 trends.**

```json
{
  "countries": ["United States", "UK", "Japan"],
  "maxTrendsPerCountry": 50
}
```

| Input | Rows |
|---|---|
| A country name, short name or two-letter code | Up to 50 current trends, top first |
| "All 58 countries" on | The current trends of every country available (about 2,700 rows) |
| A country without an X trend list | Skipped with a note in the log (not charged) |

### Why Use This Scraper?

- **Topic categories.** X labels many trends with a topic (Technology, Sports, Football, Politics, Music). You get it in its own column, ready to filter, for about a third of all trends.
- **58 countries in one run.** All of them take about a minute.
- **Filters that cost nothing.** Keep only certain categories, or only hashtags; trends left out are not charged.
- **Clean rows.** Country name and ISO code, rank, trend, category, hashtag flag and a search link on every row.
- **No X account.** Nothing to log in to and no API keys.

### Use Cases

- **Newsrooms and editors:** see what each market talks about right now.
- **Brand and PR teams:** catch a topic about your industry or company as it starts trending.
- **Marketers:** find trending hashtags in a market before you post.
- **Researchers:** compare the topics that trend across countries at the same moment.
- **Dashboards and alerts:** run it on a schedule and feed the rows to a sheet, a database or a Slack alert.

### How It Works

1. Put countries in **countries**, or turn on **allCountries**.
2. The actor reads each country's current trend list, several countries at a time.
3. Your filters are applied and each trend is saved as one row, top first.
4. Download the dataset as JSON, CSV, Excel or HTML, or read it from the API.

One country takes about 5 seconds. For trends over time, schedule the actor (for example every hour); every row carries the time it was taken.

### Input Configuration

| Field | Type | Default | What it does |
|---|---|---|---|
| `countries` | array | `["United States"]` | Country names ("United States"), short names ("UK", "UAE") or codes ("DE", "BR"). |
| `allCountries` | boolean | false | All 58 countries instead of the list. |
| `maxTrendsPerCountry` | integer | 50 | Trends per country, top first (X lists up to 50). |
| `categories` | array | — | Keep only trends whose category contains one of these words, e.g. "Sports", "Technology". |
| `onlyHashtags` | boolean | false | Keep only hashtags. |
| `maxItems` | integer | 10000 | Cap on rows across all countries. Free-plan runs return up to 100. |

#### Example input

Sports trends in five European countries:

```json
{
  "countries": ["UK", "Germany", "France", "Spain", "Italy"],
  "categories": ["Sports", "Football", "Soccer"]
}
```

### Output Samples

The values below are made up; the fields are what you get.

```json
{
  "type": "trend",
  "country": "United States",
  "countryCode": "US",
  "rank": 4,
  "name": "Microsoft",
  "isHashtag": false,
  "category": "Technology",
  "searchUrl": "https://x.com/search?q=Microsoft",
  "scrapedAt": "2026-11-13T06:00:00.000Z"
}
```

### Key Output Fields

| Field | Meaning |
|---|---|
| `country`, `countryCode` | The country of the list, with its ISO code. |
| `rank` | Place in that country's list, 1 = top. |
| `name` | The trend as X shows it; hashtags keep their `#`. |
| `category` | The topic X gives the trend, or `null` when X shows none. |
| `isHashtag` | Whether the trend is a hashtag. |
| `searchUrl` | A link to the X search for the trend. |
| `scrapedAt` | When the list was read. |

### Supported Countries

United States, China, India, Japan, Russia, Germany, Indonesia, Brazil, France, United Kingdom, Turkey, Italy, Mexico, South Korea, Canada, Spain, Saudi Arabia, Egypt, Australia, Poland, Iran, Pakistan, Vietnam, Nigeria, Bangladesh, Netherlands, Argentina, Philippines, Malaysia, Colombia, United Arab Emirates, Romania, Belgium, Switzerland, Singapore, Sweden, Norway, Austria, Kazakhstan, Algeria, Chile, Czechia, Peru, Iraq, Israel, Ukraine, Denmark, Portugal, Hungary, Greece, Finland, New Zealand, Belarus, Slovakia, Serbia, Lithuania, Luxembourg and Estonia.

### FAQ

**Do I need an X account or API keys?**
No. Pick countries and run it.

**Why do some countries return fewer than 50 trends?**
Smaller markets have shorter lists (Luxembourg showed 5, Estonia 22 in our tests).

**Why is the category empty for some trends?**
X labels only part of its trends with a topic. About a third of all trends had one in our tests; the share is higher in large markets.

**Are worldwide or city trends included?**
No, this actor returns country lists only.

**Can I get trends from earlier today?**
Schedule the actor to run every hour (or as often as you like) and keep the datasets; each row carries the time it was read.

### Pricing

- **$0.15 per 1,000 trends** saved ($0.00015 a trend). One country is about 50 trends, so about $0.0075.
- No start fee beyond Apify's own $0.00005 a run.
- Trends left out by your filters and unknown countries are free.
- Free-plan accounts get up to 100 trends a run to try it.

### Support

A country that should work and does not, or a field you need? Open an issue on the Issues tab. We read every issue.

### Explore More Scrapers

- [X (Twitter) Replies Scraper](https://apify.com/memo23/x-twitter-replies-scraper): the replies under any post.
- [X (Twitter) Search Scraper](https://apify.com/memo23/x-twitter-search-scraper): tweets by keyword, profiles, followers, communities and lists.
- [Twitter (X) Profile & Tweets Scraper](https://apify.com/memo23/twitter-x-scraper): an account's profile and tweets.

### 🤖 For AI Agents & LLM Apps

Call it with `{"countries": ["<country>"]}` and read the default dataset. Each row is one trend with stable keys; `countryCode` + `name` identify a trend in a list. Use `categories` to keep only the topics you need.

### ⚠️ Disclaimer

This actor collects the trend lists X shows publicly. It does not log in. You are responsible for following X's Terms of Service and the laws that apply to you. This actor is not affiliated with or endorsed by X Corp.

### SEO Keywords

twitter trends scraper, x trends scraper, twitter trending topics, x trending topics by country, twitter trending hashtags, trending hashtags scraper, twitter trends api, x trends api, twitter trends by country, trending topics categories, twitter trend tracker, x trending now

# Actor input Schema

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

Countries to get trends for, one per line: a name ("United States", "Japan"), a short name ("UK", "UAE") or a two-letter code ("DE", "BR"). Trends are available for 58 countries.

## `allCountries` (type: `boolean`):

Get trends for every country available, instead of the list above.

## `maxTrendsPerCountry` (type: `integer`):

Trends to return per country, top first. X lists up to 50.

## `categories` (type: `array`):

Keep only trends whose category contains one of these words, e.g. "Sports", "Technology", "Politics", "Music". Empty keeps every trend. Trends left out are not charged.

## `onlyHashtags` (type: `boolean`):

Keep only trends that are hashtags. Trends left out are not charged.

## `maxItems` (type: `integer`):

Cap on rows across all countries. Free-plan runs return up to 100.

## Actor input object example

```json
{
  "countries": [
    "United States",
    "United Kingdom",
    "Japan"
  ],
  "allCountries": false,
  "maxTrendsPerCountry": 50,
  "onlyHashtags": false,
  "maxItems": 10000
}
```

# Actor output Schema

## `results` (type: `string`):

Current trends per country with rank, name, topic category and search link.

# 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",
        "United Kingdom",
        "Japan"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("memo23/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",
        "United Kingdom",
        "Japan",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("memo23/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",
    "United Kingdom",
    "Japan"
  ]
}' |
apify call memo23/x-twitter-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,memo23/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/oL6dmZDwXIFfGyL4N/builds/f0xWMDszaEyoH3Vaf/openapi.json
