# X (Twitter) Trends Scraper (`tacps126/x-trends-scraper`) Actor

X (Twitter) trends right now for any country, big city or worldwide: trend, rank, post count, hashtag flag and search link, about 470 places. No login. Only-new trend alerts.

- **URL**: https://apify.com/tacps126/x-trends-scraper.md
- **Developed by:** [Tapaswai Choudhary](https://apify.com/tacps126) (community)
- **Categories:** Social media, Marketing, News
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.16 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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

Get what is trending on X (Twitter) right now for any country, big city or the whole world: trend, rank, number of
posts when X shows it, hashtag flag and a search link. About 470 places. No X account, no login, nothing to install.

### What you get

| Field | Example |
|---|---|
| `term` | `49ers` |
| `rank` | `1` |
| `postVolume` | `74920` (empty when X shows no count) |
| `isHashtag` | `false` |
| `place`, `country`, `geo`, `woeid` | `New York`, `United States`, `US`, `2459115` |
| `url` | `https://x.com/search?q=49ers` |
| `asOf` | `2026-11-23T10:14:32Z` |

### How to use

1. Add places under **Places**: `worldwide`, country codes or names (`US`, `India`, `Japan`), big cities
   (`New York`, `London`, `Mumbai`) or WOEID numbers.
2. Press **Start**.
3. Download as JSON, CSV or Excel, or send the trends to Slack, Discord, a webhook or Google Sheets.

#### Example input

```json
{
  "xTrendsPlaces": ["worldwide", "US", "India", "London"],
  "maxTrendsPerGeo": 20
}
```

### Trend alerts

Turn on **Only new trends** and schedule the Actor (for example every hour). Each run returns only trends that
earlier runs have not delivered that day, so you pay only for what is new. Add a Slack or Discord webhook under
**Delivery** to get them as messages.

### Pricing

| Event | Price per 1,000 |
|---|---|
| Trend | $0.20 |

Plus $0.005 per run. Higher Apify plans get the usual discount.

### Good to know

- Places are the ones X lists trends for: about 60 countries and 400 cities. Unknown places return a warning.
- X shows post counts for some trends only.
- Google search trends for the same places are available in our Google Trends Scraper.

### FAQ

**Do I need an X account or API key?** No.

**How fresh are the trends?** They are read live at run time; `asOf` is X's own timestamp.

**Can I get the posts behind a trend?** Not in this Actor. For an account's own posts use our X (Twitter) Profile
Scraper.

# Actor input Schema

## `xTrendsPlaces` (type: `array`):

Places to read X (Twitter) trends for: `worldwide`, a country code or name (`US`, `India`, `Japan`), a big city (`New York`, `London`, `Mumbai`) or a WOEID number. About 470 places are covered.

## `maxTrendsPerGeo` (type: `integer`):

Cap per place, in X's order (X lists up to 50).

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

Maximum number of trends in total.

## `onlyNew` (type: `boolean`):

Schedule the Actor and each run returns only trends that earlier runs with the same input have not delivered today. Ideal for alerts: you pay only for new trends.

## `monitorName` (type: `string`):

Optional name for the "only new" history, so several monitors can run side by side.

## `delivery` (type: `object`):

Webhook: {"webhookUrl": "https://...", "format": "json" | "slack" | "discord", "onlyWhenResults": true, "includeItems": 10}. Google Sheets: {"spreadsheetId": "<id from the sheet URL>", "sheetName": "Sheet1"} plus the service account key below; share the sheet with the service account's e-mail first. Leave empty to only save results in the dataset.

## `googleServiceAccountJson` (type: `string`):

Only for Google Sheets delivery: paste the service account's JSON key. Stored encrypted; the account sees only sheets you share with it.

## `proxyConfiguration` (type: `object`):

Apify Proxy is used by default; you don't need to change this.

## `tenantId` (type: `string`):

Optional label used to keep separate histories for different clients or teams.

## `debug` (type: `boolean`):

Save extra diagnostics with the run (for support requests).

## Actor input object example

```json
{
  "xTrendsPlaces": [
    "worldwide",
    "US",
    "India",
    "London"
  ],
  "maxTrendsPerGeo": 50,
  "maxItems": 1000,
  "onlyNew": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "debug": false
}
```

# Actor output Schema

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

One row per search (interest over time, by region, related queries) and one per Trending Now trend.

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

Counts, warnings, and whether the run stopped early.

# 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 = {
    "xTrendsPlaces": [
        "worldwide",
        "US",
        "India",
        "London"
    ],
    "maxTrendsPerGeo": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tacps126/x-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 = {
    "xTrendsPlaces": [
        "worldwide",
        "US",
        "India",
        "London",
    ],
    "maxTrendsPerGeo": 50,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("tacps126/x-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 '{
  "xTrendsPlaces": [
    "worldwide",
    "US",
    "India",
    "London"
  ],
  "maxTrendsPerGeo": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call tacps126/x-trends-scraper --silent --output-dataset

```

## MCP server setup

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