# X Trends Lookup by Country, City & WOEID (`nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid`) Actor

Get ranked trending topics on X for any country or city, or for all 467 locations at once, with trend type, ready-made search links and post volumes when X publishes them.

- **URL**: https://apify.com/nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid.md
- **Developed by:** [Nimbryxo-studio](https://apify.com/nimbryxo-studio) (community)
- **Categories:** Social media, News, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Trends Lookup by Country, City & WOEID

Get ranked trending topics from X (Twitter) for any country or city, or for every location X serves in one run — no login, no cookies, no API key. Each trend comes back with its rank, type, a ready-made search link, and the approximate post volume when X publishes it.

### What this actor does

- Looks up trends for a list of locations by name, common alias, or numeric WOEID
- Collects trends for every location X serves (around 467 countries and cities) in a single run when asked
- Keeps each trend's rank, name and type — hashtag, cashtag, or topic
- Builds a ready-made X search link for every trend
- Omits any field that has no value for a given row rather than returning a null or placeholder

### Output per row

Every row carries a `type` of `trend` or `status`.

| Field | Description |
|---|---|
| `type` | `trend` for a trending topic, `status` for a problem or summary row |
| `location` | The location you asked for, with its WOEID appended when two places share a name |
| `woeid` | X's numeric location identifier |
| `country` / `countryCode` | Country name and ISO code X reports for the location, when available |
| `placeType` | X's place type, e.g. Country, Town, or Metro |
| `rank` | Position in the trending list (1 = top trend) |
| `trend` | Trend name, hashtag, or cashtag |
| `trendType` | hashtag, cashtag, or topic |
| `searchUrl` / `trendUrl` | Ready-made X search link for the trend |
| `tweetVolume` | Approximate number of posts using the trend, only when X publishes it |
| `promoted` | Whether the trend is a promoted one |
| `asOf` | When X calculated this trending list |
| `collectedAt` | When this row was collected |

Status rows carry a `status` value (such as `unknownLocation`, `notAvailable`, or `rateLimited`) and a human-readable `message`, plus `didYouMean` suggestions for likely typos. When collecting every location, problems are also summarized into one `collectionSummary` row with `trendCount`, `locationsWithTrends`, `locationsTotal`, `locationsWithoutTrends`, `notAvailableLocations`, and `failedLocations`.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `locations` | array of strings | – | Countries or cities to get trends for — names, aliases (USA, UK, NYC), or numeric WOEIDs. Put "all" to collect every location. |
| `allLocations` | boolean | false | Collect trends for every location X serves (around 467 countries and cities); ignores `locations` when on |
| `includeTweetVolume` | boolean | true | Include the approximate post volume for a trend, when X publishes it |
| `includeSearchUrls` | boolean | true | Include a ready-made X search link for every trend |
| `maxTrendsPerLocation` | integer | 50 | How many ranked trends to keep per location (1-50) |
| `proxyConfiguration` | object | – | Optional proxy override, useful for large or repeated runs |

#### Example: a handful of countries

```json
{
  "locations": ["United States", "United Kingdom", "Japan"],
  "maxTrendsPerLocation": 20
}
```

#### Example: cities and a WOEID together

```json
{
  "locations": ["London", "New York", "Dubai", "23424977"],
  "includeTweetVolume": true
}
```

#### Example: every location in one run

```json
{
  "allLocations": true,
  "maxTrendsPerLocation": 50
}
```

### Use cases

- **Social listening** — track what's breaking out in any market, hour by hour
- **Newsroom monitoring** — spot emerging stories by city or country early
- **Content scheduling** — plan posts around live trends using the ready-made search links
- **Cross-country comparison** — compare trending topics across markets to study regional interest
- **Automated reporting** — capture timestamped trend snapshots for recurring client or team reports

### FAQ

**Do I need an X/Twitter account?**
No. This actor works without login, cookies, or an API key.

**How many locations can I get trends for?**
X currently serves trends for around 467 countries and cities; `allLocations` covers every one of them in a single run.

**Can I look up a city instead of a country?**
Yes — major cities like London, New York, Tokyo, Dubai, and Sydney work by name, as do countries worldwide. For a location not in the friendly list, paste its numeric WOEID, or run `allLocations` and filter the results by `location` afterward.

**How do I use a WOEID?**
Paste the number directly into `locations`. Rows for a WOEID you entered are still labeled with the place name X returns, so the dataset stays readable.

**Why is `tweetVolume` missing on some rows?**
X only publishes a post-volume figure for a subset of trends. When X doesn't provide one, the field is left out rather than showing a misleading number.

**What does a `status` row mean?**
It means the location wasn't recognized, X temporarily limited the request, or X doesn't serve trends for that location at all (China, for example). The `message` field explains what happened so a run never fails silently.

**How big is a full `allLocations` run?**
It can return roughly 22,000 rows (around 467 locations times up to 50 trends each), plus one `collectionSummary` row reporting how many locations succeeded, failed, aren't served by X, or returned no trends.

**How fresh is the data?**
X recalculates trends continuously; the `asOf` field tells you exactly when X computed the list for each location.

**Is this affiliated with X?**
No. This actor reads X's publicly visible trending data and is not affiliated with, endorsed by, or sponsored by X Corp.

# Actor input Schema

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

Countries or cities to get trends for. Examples: Worldwide, United States, United Kingdom, Canada, Australia, India, Pakistan, Japan, South Korea, Germany, France, Brazil, London, New York, Tokyo, Paris, Dubai, Karachi, Sydney. You can also paste a numeric WOEID such as 23424977.

## `allLocations` (type: `boolean`):

Collect trends for every location X serves (currently 467 countries and cities, up to 50 trends each). When enabled, the Locations list is ignored. Tip: you can also put "all" in the Locations list.

## `includeTweetVolume` (type: `boolean`):

Include the approximate number of posts using each trend when X publishes it. X often omits it, so the field is present only when available.

## `includeSearchUrls` (type: `boolean`):

Include a ready-made X search link for every trend.

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

How many ranked trends to keep for each location. X publishes up to 50.

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

Optional. Use a proxy if you plan large or repeated runs.

## Actor input object example

```json
{
  "locations": [
    "United States",
    "Pakistan",
    "Japan",
    "London",
    "23424977"
  ],
  "allLocations": false,
  "includeTweetVolume": true,
  "includeSearchUrls": true,
  "maxTrendsPerLocation": 50
}
```

# Actor output Schema

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

Ranked trending topics per location, plus status rows for unknown locations or problems.

# 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"
    ],
    "allLocations": false,
    "includeTweetVolume": true,
    "includeSearchUrls": true,
    "maxTrendsPerLocation": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid").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"],
    "allLocations": False,
    "includeTweetVolume": True,
    "includeSearchUrls": True,
    "maxTrendsPerLocation": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid").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"
  ],
  "allLocations": false,
  "includeTweetVolume": true,
  "includeSearchUrls": true,
  "maxTrendsPerLocation": 50
}' |
apify call nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nimbryxo-studio/x-trends-lookup-by-country-city-and-woeid"
        }
    }
}
```

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/mipelXF4sTs2Hzgga/builds/rbtnTjPpD8aMuFo13/openapi.json
