# X (Twitter) Trends Scraper (`eunit/x-twitter-trends-scraper`) Actor

Scrape real-time Twitter/X trends from any country or city. Get top 50 trending hashtags, tweet counts, and hourly history. Ideal for social media monitoring, viral topic tracking, and market research. Fast, reliable, and supports granular location data.

- **URL**: https://apify.com/eunit/x-twitter-trends-scraper.md
- **Developed by:** [Emmanuel Uchenna](https://apify.com/eunit) (community)
- **Categories:** Lead generation, Social media, News
- **Stats:** 46 total users, 9 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 1.06 out of 5 stars

## Pricing

from $99.00 / 1,000 per success results

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

## Twitter (X) Trends Scraper

### Overview

The **Twitter (X) Trends Scraper** is a powerful tool designed to extract real-time trending topics from countries and cities worldwide. It provides a comprehensive view of what's happening now, making it an essential tool for:

- **Social Media Monitoring:** Track viral hashtags and topics as they emerge.
- **Market Research:** Understand regional interests and granular location-based trends.
- **Content Strategy:** Discover high-engagement topics for your content calendar.
- **Brand Sentiment:** Monitor relevant industry keywords in specific locations.

### Features

- **Granular Location Support:** Scrape trends for huge list of **countries** and specific **cities** (e.g., "United States", "New York", "London", "Lagos").
- **Comprehensive Data:** Extracts data from the **Timeline** (hourly trends), **Tag Cloud**, and **Top Trends Table**.
- **Deep Insights:** Retrieves trend **rank**, **hashtag/name**, **tweet counts**, and direct links.
- **Fast & Reliable:** Built for high performance and low overhead.
- **Easy Integration:** Export data in JSON, CSV, Excel, and more for seamless analysis.

### No Setup Required

Unlike many other scrapers, this Actor requires **no complex proxy configuration**. It is optimized to run out-of-the-box on the Apify platform, handling connections automatically to ensure high success rates.

### How to Use

1. **Select Location:** specific country or city from the dropdown menu (e.g., "United States - New York").
2. **Run Scraper:** Click the "Run" button.
3. **Download Data:** Export the results in your preferred format (JSON, CSV, etc.).

### Output Format

The scraper returns a structured dataset containing trend information. Here is a sample of the JSON output:

```json
{
  "scraped_at": "2023-10-27T10:30:00.000Z",
  "country_input": "united-states/new-york",
  "timeline": [
    {
      "datetime": "2 minutes ago",
      "timestamp": "1698402400",
      "trends": [
        {
          "rank": 1,
          "name": "#FridayFeeIing",
          "link": "https://twitter.com/search?q=%23FridayFeeIing",
          "tweet_count": "50K"
        },
        {
          "rank": 2,
          "name": "New York Giants",
          "link": "https://twitter.com/search?q=%22New+York+Giants%22",
          "tweet_count": "12K"
        },
        // ...
      ]
    }
  ],
  "tag_cloud": [
    {
      "name": "#TechTrends",
      "link": "https://twitter.com/search?q=%23TechTrends"
    }
  ],
  "table_data": [
    {
       "rank": "1",
       "name": "#AI",
       "tweet_count": "100K"
    }
  ]
}
```

### FAQs

#### Is it legal to scrape trends?

Extracting publicly available factual data like "trending topics" is generally considered legal. However, you should always respect the terms of service of the target website and ensure your use case complies with local regulations like GDPR or CCPA.

### Related Actors

Expand your data collection capabilities with these other powerful Apify Actors developed by the same author:

#### [Twitter (X) Trends Scraper (PPE)](https://apify.com/eunit/x-twitter-trends-ppe)

- **URL:** <https://apify.com/eunit/x-twitter-trends-ppe>
- **Description:** Scrape real-time Twitter/X trends from any country or city. Get top 50 trending hashtags, tweet counts, and hourly history. Ideal for social media monitoring, viral topic tracking, and market research. Fast, reliable, and supports granular location data. Pay Per Event.

#### [Enhanced Twitter (X) Bot](https://apify.com/eunit/enhanced-twitter-x-bot)

- **URL:** <https://apify.com/eunit/enhanced-twitter-x-bot>
- **Description:** A versatile Twitter bot for powerful social media automation. This tool uses the Twitter API to auto-like, auto-follow, and manages your followers. Configure keywords, schedules, and safety limits for effective Twitter engagement and account growth.

#### [Target Product Reviews Scraper](https://apify.com/eunit/target-reviews-scraper)

- **URL:** <https://apify.com/eunit/target-reviews-scraper>
- **Description:** A tool for market research and e-commerce analysis. Scrape **product reviews, star ratings, and consumer sentiment** from Target.com, useful for businesses analyzing the retail landscape in target neighborhoods.

### Support & Feedback

We are constantly improving this scraper. If you have feature requests, find a bug, or need a specific customization, please create an issue on the [Actor’s Issues tab](https://console.apify.com/actors/gt00A5awlaRmNFUzd/issues) in Apify Console.

# Actor input Schema

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

Select the location to scrape trends for.

## Actor input object example

```json
{
  "country": "Worldwide"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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("eunit/x-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("eunit/x-twitter-trends-scraper").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 eunit/x-twitter-trends-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/egar8SjmU9fXaZph6/builds/Rnx82b56IdEZJmoC0/openapi.json
