# X Twitter Trends by Location Scraper (`khadinakbar/x-trends-by-location-scraper`) Actor

Scrape live X/Twitter trending topics for any city, country, or worldwide. 100+ cities, 46 countries. No API key required. MCP-ready.

- **URL**: https://apify.com/khadinakbar/x-trends-by-location-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, MCP servers, News
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 trend scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## X (Twitter) Trends by Location Scraper

Fetch live X/Twitter trending topics for **any city, country, or worldwide** — no API key required. Supports 100+ cities and 46 countries. Returns ranked trend list with tweet volume (when available), trend type classification, and direct X search links. MCP-ready, cookieless, no login.

### What you get

| Field | Example |
|-------|---------|
| `locationName` | `London` |
| `locationType` | `city` |
| `locationCountry` | `United Kingdom` |
| `locationCountryCode` | `GB` |
| `position` | `1` |
| `trendName` | `#WorldCup` |
| `trendType` | `hashtag` |
| `tweetVolume` | `125000` |
| `xSearchUrl` | `https://x.com/search?q=%23WorldCup&src=trend_click` |
| `dataSource` | `trends24` |
| `snapshotAt` | `2026-08-19T12:34:56.000Z` |

### How it works

- **City-level** trends: scraped from [trends24.in](https://trends24.in) — 100+ cities worldwide
- **Country + Worldwide** trends: scraped from [GetDayTrends](https://getdaytrends.com) — 46 countries + global
- Cookieless, no login, no API key needed
- Automatic fallback: if city trends page fails, falls back to GetDayTrends country page

### Supported locations (120+)

Enter any of:

- **City name**: `London`, `New York`, `Tokyo`, `Dubai`, `Lagos`, `São Paulo`, `Berlin`
- **Country name**: `Japan`, `Brazil`, `United States`, `India`, `Nigeria`
- **"Worldwide"** for the global aggregate
- **Aliases**: `US`, `UK`, `UAE`, `NYC`, `LA`, `SF`

#### Sample cities available

New York, Los Angeles, Chicago, Houston, Dallas, Miami, Atlanta, Seattle, Denver, Boston, Las Vegas, San Francisco, San Diego, Portland, Detroit, Minneapolis, Philadelphia, Phoenix, San Antonio, Kansas City (US) — London, Manchester, Birmingham, Leeds, Glasgow (UK) — Tokyo, Osaka, Sapporo (Japan) — Sydney, Melbourne (Australia) — São Paulo, Rio de Janeiro (Brazil) — Toronto, Vancouver, Montreal (Canada) — Paris, Berlin, Madrid, Barcelona, Rome, Milan, Amsterdam, Brussels, Vienna, Zurich, Stockholm, Copenhagen, Oslo, Helsinki, Warsaw, Istanbul, Moscow — Dubai, Riyadh, Jeddah, Cairo — Seoul, Mumbai, Delhi, Bangalore, Bangkok, Kuala Lumpur, Jakarta, Manila, Karachi — Lagos, Nairobi, Johannesburg, Accra — Buenos Aires, Bogota, Lima, Santiago, Caracas, Mexico City, and more.

### Quick start

```json
{
  "locations": ["Worldwide", "United States", "London", "Tokyo"],
  "maxTrendsPerLocation": 10
}
```

No API key needed. Just run.

### API example (Apify REST)

```bash
curl -X POST "https://api.apify.com/v2/acts/khadinakbar~x-trends-by-location-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "locations": ["New York", "London", "Tokyo"],
    "maxTrendsPerLocation": 10
  }'
```

### Pricing

| Event | Price |
|-------|-------|
| Actor start | $0.00005 |
| Trend row saved | $0.003 |

**Example:** 5 locations × 10 trends = 50 rows × $0.003 = **$0.15** + platform usage (compute, typically <$0.01).

### Input reference

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `locations` | string\[] | No | `["Worldwide","United States","United Kingdom"]` | City or country names, or "Worldwide" |
| `maxTrendsPerLocation` | integer | No | `10` | 1–50 trends per location |
| `dedupeTrends` | boolean | No | `true` | Skip duplicate trend names across locations |

### Use cases

- **Brand monitoring** — track when your brand or campaign hashtag trends in target cities
- **Content strategy** — surface what's trending locally before creating posts
- **News monitoring** — catch breaking topics in specific markets before they go mainstream
- **Social intelligence** — feed live trend data to AI agents for summarization or alerting
- **Competitive analysis** — monitor competitor campaign hashtag velocity by city

### MCP / AI agent usage

```
Tool: apify--x-trends-by-location-scraper
Input: { "locations": ["New York", "London"], "maxTrendsPerLocation": 5 }
Returns: ranked trend rows with trendName, tweetVolume, xSearchUrl, locationType, dataSource
Cost: $0.003/trend + $0.00005/start
```

### Limitations

- Tweet volume is null for many trends — source pages do not always expose volume
- X/Twitter trends update roughly every 5 minutes at the source; scrape freshness depends on run timing
- Historical trends are not available — this actor returns current live trends only
- City-level trends depend on trends24.in coverage; cities not in the supported set fall back to their country page
- Do not use this actor for X posts, profiles, or search results — see `x-tweet-scraper` or `twitter-profile-followers-scraper`

### Related actors

- **[x-tweet-scraper](https://apify.com/khadinakbar/x-tweet-scraper)** — scrape tweets by keyword, hashtag, or user
- **[x-twitter-trends-scraper](https://apify.com/khadinakbar/x-twitter-trends-scraper)** — original country-level only trends scraper
- **[twitter-profile-followers-scraper](https://apify.com/khadinakbar/twitter-profile-followers-scraper)** — X profile data and follower lists
- **[google-trends-scraper](https://apify.com/khadinakbar/google-trends-scraper)** — Google Trends data by keyword and region
- **[tiktok-trending-hashtags-scraper](https://apify.com/khadinakbar/tiktok-trending-hashtags-scraper)** — trending on TikTok by region

### Builder's note

The official X/Twitter Trends API (`GET /2/trends/by/woeid/{woeid}`) requires a $5,000/month Pro subscription. Third-party providers (ScrapeCreators, SociaVault) do not currently expose a Twitter trends endpoint in their route catalog. This actor uses [trends24.in](https://trends24.in) for city-level data and [GetDayTrends](https://getdaytrends.com) for country/worldwide data — both are real-time public pages that aggregate official X trend data without requiring a key. The fallback chain (city → country) handles page unavailability gracefully.

### Legal

Public trend data is used for informational purposes. Use responsibly and in accordance with X's terms of service and your local laws.

# Actor input Schema

## `locations` (type: `array`):

List of locations to fetch X/Twitter trending topics for. Each entry can be a city name ('London', 'Tokyo', 'New York'), a country name ('Japan', 'Brazil', 'United States'), or 'Worldwide'. City-level trends use trends24.in; country and worldwide trends use GetDayTrends. Defaults to Worldwide + United States + United Kingdom. Do not use for tweet, profile, or hashtag search — see x-tweet-scraper.

## `maxTrendsPerLocation` (type: `integer`):

Maximum number of trending topics to return per location. GetDayTrends and trends24.in typically provide up to 20–50 live trends per location. Defaults to 10 for lean, cost-efficient runs. Increase to 50 to capture all available trends. NOT a pagination offset — it is a per-location cap.

## `dedupeTrends` (type: `boolean`):

When enabled, a trend name that appears in more than one requested location is only saved once (first occurrence by location order). Disable to preserve all location rows even when trend names repeat across overlapping regions.

## Actor input object example

```json
{
  "locations": [
    "Worldwide",
    "United States",
    "United Kingdom"
  ],
  "maxTrendsPerLocation": 10,
  "dedupeTrends": true
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset API URL containing one row per trending topic per location.

## `output` (type: `string`):

Compact OUTPUT record with outcome, counts, and warnings.

## `runSummary` (type: `string`):

Detailed RUN\_SUMMARY record for diagnostics and release verification.

# 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 = {
    "locations": [
        "Worldwide",
        "United States",
        "United Kingdom"
    ],
    "maxTrendsPerLocation": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/x-trends-by-location-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 = {
    "locations": [
        "Worldwide",
        "United States",
        "United Kingdom",
    ],
    "maxTrendsPerLocation": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/x-trends-by-location-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 '{
  "locations": [
    "Worldwide",
    "United States",
    "United Kingdom"
  ],
  "maxTrendsPerLocation": 10
}' |
apify call khadinakbar/x-trends-by-location-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khadinakbar/x-trends-by-location-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/5nglPYBe3EUIlXbko/builds/zHWKeeqWMWQNHVFye/openapi.json
