# Twitter Trends Scraper (`easyapi/twitter-trends-scraper`) Actor

Scrape Twitter trending topics by country or worldwide. Get ranks, trend names, detail links, and position charts for now, hours ago, or historical dates. 📈

- **URL**: https://apify.com/easyapi/twitter-trends-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Social media, SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 10 total users, 3 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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.

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

## Twitter Trends Scraper

Scrape Twitter/X trending topics by country or worldwide. Extract trend ranks, names, position chart metadata, and Twitter search links for current trends, recent hours, or historical date/time snapshots.

### Key Features

- Scrape trends for 60+ countries and worldwide
- Support current trends, N hours ago, or a specific UTC date/hour
- Extract rank, trend name, and graph title
- Batch scrape multiple countries in one run
- Optional proxy configuration

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| countries | array | Yes | Country slugs, e.g. `australia`, `united-states`, `worldwide` |
| hoursAgo | integer | No | Trends from N hours ago (0 = now) |
| date | string | No | Historical date `YYYY-MM-DD` |
| hour | integer | No | UTC hour 0-23 when using date |
| maxItems | integer | No | Max trends per country (default: 50) |
| proxyConfiguration | object | No | Proxy settings |

#### Input Example

```json
{
    "countries": ["australia", "united-states"],
    "hoursAgo": 2,
    "maxItems": 50
}
```

Historical example:

```json
{
    "countries": ["worldwide"],
    "date": "2026-05-13",
    "hour": 22,
    "maxItems": 50
}
```

### Output

Each trend is saved as one dataset record:

```json
{
    "country": "australia",
    "hoursAgo": 2,
    "date": null,
    "hour": null,
    "rank": 1,
    "trend": "Senegal",
    "trendSlug": "Senegal",
    "twitterSearchUrl": "https://x.com/search?q=Senegal",
    "graphTitle": "Senegal: trending position over last 8 hours",
    "scrapedAt": "2026-07-02T12:00:00.000Z"
}
```

### Supported Countries

Worldwide, Algeria, Argentina, Australia, Austria, Bahrain, Belarus, Belgium, Brazil, Canada, Chile, Colombia, Denmark, Dominican Republic, Ecuador, Egypt, France, Germany, Ghana, Greece, Guatemala, India, Indonesia, Ireland, Israel, Italy, Japan, Jordan, Kenya, Korea, Kuwait, Latvia, Lebanon, Malaysia, Mexico, Netherlands, New Zealand, Nigeria, Norway, Oman, Pakistan, Panama, Peru, Philippines, Poland, Portugal, Puerto Rico, Qatar, Russia, Saudi Arabia, Singapore, South Africa, Spain, Sweden, Switzerland, Thailand, Turkey, Ukraine, United Arab Emirates, United Kingdom, United States, Venezuela, Vietnam

### Use Cases

- Social media trend monitoring
- Regional market and news research
- Competitive intelligence
- Content planning and hashtag discovery

# Actor input Schema

## `countries` (type: `array`):

Countries or regions to scrape trends for. Use worldwide for global trends

## `hoursAgo` (type: `integer`):

Fetch trends from N hours ago on the current day. Leave 0 to use current trends or a custom date

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

Historical date in YYYY-MM-DD format. When set, hour is also required

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

Hour of day in UTC (0-23) when using date

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

Maximum number of trends to return per country

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

Proxy settings for the actor

## Actor input object example

```json
{
  "countries": [
    "australia"
  ],
  "hoursAgo": 0,
  "date": "",
  "hour": 0,
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "countries": [
        "australia"
    ],
    "hoursAgo": 0,
    "date": "",
    "hour": 0,
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/twitter-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 = {
    "countries": ["australia"],
    "hoursAgo": 0,
    "date": "",
    "hour": 0,
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/twitter-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 '{
  "countries": [
    "australia"
  ],
  "hoursAgo": 0,
  "date": "",
  "hour": 0,
  "maxItems": 50
}' |
apify call easyapi/twitter-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,easyapi/twitter-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/dakztetwflPo6N7PH/builds/FCi8lTFWqfHMLBqWr/openapi.json
