# Twitter / X Trending Topics — Real-Time & Historical Trends (`maged120/twitter-trends`) Actor

Scrape trending topics from Twitter/X. Retrieve current trending hashtags and topics by country, with support for historical trend data across different time periods.

- **URL**: https://apify.com/maged120/twitter-trends.md
- **Developed by:** [Maged](https://apify.com/maged120) (community)
- **Categories:** Automation, Social media
- **Stats:** 26 total users, 5 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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 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

### What does Twitter / X Trending Topics Scraper do?

**Twitter / X Trending Topics Scraper** extracts the current trending topics from Twitter/X in real time. Get trending hashtags, topics, and tweet volumes by country — without a Twitter API key, developer account, or paid API subscription.

This Actor runs on the [Apify platform](https://apify.com). Use it for real-time trend monitoring, content strategy, brand monitoring, or market research.

### Why use Twitter / X Trending Topics Scraper?

- **No Twitter API key** — bypasses Twitter API v2 access costs and approval requirements
- **Country-specific trends** — get trending topics for any supported country/region
- **Real-time data** — see what is trending right now
- **Scheduled monitoring** — run hourly or daily to track trend history
- **Content strategy** — find trending topics before writing or posting

### How to use Twitter / X Trending Topics Scraper

1. Open the Actor and click **Try for free**
2. Select the country or WOEID (Where on Earth ID) for trends
3. Click **Start** — trending topics appear in the Output tab
4. Download as JSON or CSV, or set up a schedule for continuous monitoring

### Input

```json
{
  "countries": ["United States", "United Kingdom", "Egypt"],
  "maxTrends": 50
}
```

| Field | Type | Description | Default |
|---|---|---|---|
| `countries` | array | Country names or WOEID codes | `["Worldwide"]` |
| `maxTrends` | integer | Max trending topics per country | `50` |

### Output

Results are stored in the Apify dataset. Download in JSON, CSV, HTML, or Excel.

```json
{
  "country": "United States",
  "rank": 1,
  "name": "#MondayMotivation",
  "tweetVolume": 125000,
  "url": "https://twitter.com/search?q=%23MondayMotivation",
  "scrapedAt": "2024-03-20T09:00:00Z"
}
```

### Output fields

| Field | Type | Description |
|---|---|---|
| `country` | string | Country for this trend |
| `rank` | number | Trend ranking position |
| `name` | string | Trend name or hashtag |
| `tweetVolume` | number | Approximate tweet count (when available) |
| `url` | string | Twitter search URL for this trend |
| `scrapedAt` | string | Data collection timestamp |

### Cost

Pay-per-result pricing:

| Volume | Estimated cost |
|---|---|
| 1 country (50 trends) | ~$0.01–$0.05 |
| 10 countries | ~$0.10–$0.50 |
| 100 countries | ~$1–$5 |

### Tips

- Schedule this Actor to run hourly to build a trend history database
- Compare trending topics across countries to spot globally-viral content early
- Use Apify webhooks to alert your team when a specific keyword enters the trending list
- Combine with social listening tools to track sentiment around trending topics

### FAQ

**Does this require a Twitter account or API key?**
No — the Actor uses Twitter's public trending interface.

**How often do trends update on Twitter?**
Twitter trends typically refresh every few minutes.

**Can I track trends for a specific city?**
Yes — use WOEID codes to specify city-level trends where supported.

**Is this Actor maintained?**
Yes. Report bugs or feature requests in the Issues tab.

**Need help or have questions?**
Open an issue in the Issues tab or reach out on Discord: **maged03211**

# Actor input Schema

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

Country code for trends (e.g., 'united-states', 'united-kingdom'). Leave empty for worldwide trends.

## `date` (type: `string`):

Date for trends in YYYY-MM-DD format, or 'today' for current trends. Must be between 2024-05-15 and today.

## `hour` (type: `integer`):

Specific hour for trends (0-23 in UTC). Leave empty for daily trends.

## `limit` (type: `integer`):

Maximum number of trends to return (10-50). Defaults to 50 if not specified.

## `queries` (type: `array`):

Array of multiple queries to process in batch mode. Each query should have country, date, and hour properties.

## Actor input object example

```json
{
  "country": "united-states",
  "date": "2024-12-01",
  "hour": 14,
  "limit": 50
}
```

# 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 = {};

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

# Run the Actor and wait for it to finish
run = client.actor("maged120/twitter-trends").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 '{}' |
apify call maged120/twitter-trends --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HjgaVd5WSF2Heyf9x/builds/MGxc7foZl31gU6k4J/openapi.json
