# X (twitter) Trends by Country (`datamagnet/x-twitter-trends-by-country`) Actor

Get the latest trends for a selected country or for all countries in plain language.

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

## Pricing

from $3.00 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Country Trends Fetcher — Trends Scraper and Data Collector

Country Trends Fetcher helps you quickly get the latest trending topics for one selected country or the full worldwide list in a single run. It is built for marketers, researchers, journalists, analysts, and anyone who wants a simple way to collect trend data without digging through complicated tools. Use it to monitor what people are talking about right now, compare countries, and export clean trend data for reporting or planning. The actor returns the raw results exactly as provided by the source, so you get the original trend names and context with no extra formatting.

### Key Features
- Extract the latest trend data for a specific country in one simple run.
- Collect worldwide trends by choosing the All option.
- Preserve the original trend names, descriptions, and context exactly as received.
- Support fast trend monitoring for news, marketing, and research workflows.
- Export results in a format that is easy to review, share, and analyze.
- Save time by avoiding manual checking across multiple countries.
- Deliver plain-language trend data that is easy for non-technical teams to use.

### Use Cases

#### Market Research
Market researchers use this actor to see what is trending in a chosen country and spot shifts in public attention. The returned fields, such as name and context, help teams understand which topics are gaining visibility and whether they relate to business, travel, entertainment, or other categories.

#### Brand Monitoring
Brand and communications teams can track trending conversations in a target market before launching campaigns or announcements. By reviewing the trend name and context, they can decide whether to align messaging with current public interest or avoid sensitive topics.

#### Newsroom Planning
Editors and journalists can use the trend list to identify timely stories and audience interests in a specific country. The context field helps them quickly see whether a trend is tied to politics, business, travel, or culture, which supports faster editorial decisions.

#### Social Media Strategy
Social media managers can use the data to plan posts that match what people are already discussing. The trend name gives them the exact topic to reference, while the context helps them choose the right tone and channel for the audience.

#### International Comparison
Analysts who work across regions can run the actor for different countries and compare what is trending in each market. This makes it easier to identify local differences, regional opportunities, and country-specific audience behavior.

#### Content Ideation
Content creators and SEO teams can turn trending topics into articles, videos, newsletters, or campaign ideas. The raw trend names provide immediate inspiration, while the context helps them decide which ideas are most relevant for their audience.

### Input

| Field | Type | Required | Description | Example |
|---|---|---:|---|---|
| country | string | Yes | Choose the country you want trend data for, or select All to get the full global list. | ALL |

### Output

| Field | Type | Description |
|---|---|---|
| name | string | The trending topic name exactly as provided by the source. This is the main item you will want to review, share, or track. |
| description | string or null | Extra detail about the trend, if available. Some trends may not include a description. |
| context | string | A short label that explains what kind of trend it is, such as business, travel, or entertainment. |

### Sample Output

```json
{
  "name": "#JantaKeYogi",
  "description": null,
  "context": "Business & finance · Trending"
}
````

### How It Works

1. You choose one country or select All for the worldwide list.
2. The actor gathers the latest trend data automatically.
3. It keeps the original trend information exactly as received.
4. The results are prepared for easy review and export.
5. You download or reuse the data in your reporting, research, or content workflow.

### Getting Started

Getting started is simple and does not require coding experience. Click Try for free, choose the country you want, and then click Run. In a short time, you will receive the latest trend data in a format that is easy to work with. You can view and export the results as JSON, CSV, or Excel, depending on how you want to use the data.

### Frequently Asked Questions

#### Do I need technical skills?

No. This actor is designed for business users, researchers, and marketers who want trend data without dealing with complicated setup. You only need to choose a country and run it.

#### How fast does it run?

It is built to return trend data quickly, since it only needs to fetch the latest list for the country you selected. The exact time can vary depending on the size of the result and current source response time.

#### What format is the output?

You can work with the results in JSON, CSV, or Excel. That makes it easy to review the trends yourself or share them with teammates who prefer spreadsheets.

#### Is this legal to use?

Yes, when used in a way that follows the rules and policies of the source and your own internal compliance requirements. It is always a good idea to review how you plan to use the data, especially for commercial or public-facing projects.

#### Can I schedule it to run automatically?

Yes, you can set it up to run on a schedule if you want regular trend updates. This is useful for daily monitoring, weekly reporting, or keeping an eye on changes in a specific market over time.

# Actor input Schema

## `country` (type: `string`):

Choose the country you want trend data for, or select ALL to get the full global list.

## Actor input object example

```json
{
  "country": "ALL"
}
```

# 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 = {
    "country": "ALL"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamagnet/x-twitter-trends-by-country").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 = { "country": "ALL" }

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

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

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

```

## CLI example

```bash
echo '{
  "country": "ALL"
}' |
apify call datamagnet/x-twitter-trends-by-country --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamagnet/x-twitter-trends-by-country",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X (twitter) Trends by Country",
        "description": "Get the latest trends for a selected country or for all countries in plain language.",
        "version": "0.0",
        "x-build-id": "P6dG5s6I8TFZNUfmL"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamagnet~x-twitter-trends-by-country/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamagnet-x-twitter-trends-by-country",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamagnet~x-twitter-trends-by-country/runs": {
            "post": {
                "operationId": "runs-sync-datamagnet-x-twitter-trends-by-country",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamagnet~x-twitter-trends-by-country/run-sync": {
            "post": {
                "operationId": "run-sync-datamagnet-x-twitter-trends-by-country",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "country"
                ],
                "properties": {
                    "country": {
                        "title": "Country",
                        "enum": [
                            "ALL",
                            "USA",
                            "FRA",
                            "AFG",
                            "ALB",
                            "DZA",
                            "AND",
                            "AGO",
                            "ATG",
                            "ARG",
                            "ARM",
                            "AUS",
                            "AUT",
                            "AZE",
                            "BHS",
                            "BHR",
                            "BGD",
                            "BRB",
                            "BLR",
                            "BEL",
                            "BLZ",
                            "BEN",
                            "BTN",
                            "BOL",
                            "BIH",
                            "BWA",
                            "BRA",
                            "BRN",
                            "BGR",
                            "BFA",
                            "BDI",
                            "KHM",
                            "CMR",
                            "CAN",
                            "CPV",
                            "CAF",
                            "TCD",
                            "CHL",
                            "CHN",
                            "COL",
                            "COM",
                            "COG",
                            "CRI",
                            "CIV",
                            "HRV",
                            "CUB",
                            "CYP",
                            "CZE",
                            "DNK",
                            "DJI",
                            "DMA",
                            "DOM",
                            "ECU",
                            "EGY",
                            "SLV",
                            "GNQ",
                            "ERI",
                            "EST",
                            "SWZ",
                            "ETH",
                            "FJI",
                            "FIN",
                            "GAB",
                            "GMB",
                            "GEO",
                            "DEU",
                            "GHA",
                            "GRC",
                            "GRD",
                            "GTM",
                            "GIN",
                            "GNB",
                            "GUY",
                            "HTI",
                            "HND",
                            "HUN",
                            "ISL",
                            "IND",
                            "IDN",
                            "IRN",
                            "IRQ",
                            "IRL",
                            "ISR",
                            "ITA",
                            "JAM",
                            "JPN",
                            "JOR",
                            "KAZ",
                            "KEN",
                            "KIR",
                            "KWT",
                            "KGZ",
                            "LAO",
                            "LVA",
                            "LBN",
                            "LSO",
                            "LBR",
                            "LBY",
                            "LIE",
                            "LTU",
                            "LUX",
                            "MDG",
                            "MWI",
                            "MYS",
                            "MDV",
                            "MLI",
                            "MLT",
                            "MHL",
                            "MRT",
                            "MUS",
                            "MEX",
                            "FSM",
                            "MDA",
                            "MCO",
                            "MNG",
                            "MNE",
                            "MAR",
                            "MOZ",
                            "MMR",
                            "NAM",
                            "NRU",
                            "NPL",
                            "NLD",
                            "NZL",
                            "NIC",
                            "NER",
                            "NGA",
                            "MKD",
                            "NOR",
                            "OMN",
                            "PAK",
                            "PLW",
                            "PAN",
                            "PNG",
                            "PRY",
                            "PER",
                            "PHL",
                            "POL",
                            "PRT",
                            "QAT",
                            "ROU",
                            "RUS",
                            "RWA",
                            "KNA",
                            "LCA",
                            "VCT",
                            "WSM",
                            "SMR",
                            "STP",
                            "SAU",
                            "SEN",
                            "SRB",
                            "SYC",
                            "SLE",
                            "SGP",
                            "SVK",
                            "SVN",
                            "SLB",
                            "SOM",
                            "ZAF",
                            "SSD",
                            "ESP",
                            "LKA",
                            "SDN",
                            "SUR",
                            "SWE",
                            "CHE",
                            "SYR",
                            "TJK",
                            "TZA",
                            "THA",
                            "TLS",
                            "TGO",
                            "TON",
                            "TTO",
                            "TUN",
                            "TUR",
                            "TKM",
                            "TUV",
                            "UGA",
                            "UKR",
                            "ARE",
                            "GBR",
                            "URY",
                            "UZB",
                            "VUT",
                            "VEN",
                            "VNM",
                            "YEM",
                            "ZMB",
                            "ZWE"
                        ],
                        "type": "string",
                        "description": "Choose the country you want trend data for, or select ALL to get the full global list."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
