# X/Twitter Trends scraper (`simoit/x-twitter-trends-scrapper`) Actor

X global trending feed from `/i/jf/global-trending/home` with country and category selection

- **URL**: https://apify.com/simoit/x-twitter-trends-scrapper.md
- **Developed by:** [simoit](https://apify.com/simoit) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 11 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.15 / 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

## Global Trending Scraper

![SIMO IT logo](https://simoit.tech/favicon.ico)

Collect tweet timelines from X global trending feeds for a selected country and optional category.

These trends come from the newer X global trending surface:
<https://x.com/i/jf/global-trending/home>

### About SIMO IT

SIMO IT builds practical social data products that support fast insight loops for marketing, PR, research, and trend monitoring teams.
We focus on reliable data collection, practical automations, and production-ready scraping workflows for teams that need signal, not dashboard theater.

### Features

- choose a country from a ready-made selector
- optionally switch to any supported global category such as `news`, `sports`, `technology`, `business_and_finance`, or `gaming`
- paginate through the global trending timeline
- push only tweet records from the backend `data[]` envelope to the dataset

### Use cases

- monitor what is trending in one selected country
- compare category-specific trend feeds across markets
- collect fresh social content for reporting and alerting
- feed dashboards, LLM workflows, and research pipelines with current trend posts

### How to use

1. Choose `Country`.
2. Choose `Category`.
3. Set pagination if you want more than one page.
4. Run the Actor.

The Actor uses the managed `twitter-scrapper` backend and does not require manual timeline tokens.

Need a custom plan, custom limits, or a tailored data workflow? Contact `contact@simoit.tech`.

If you want the older preset Explore-tab trend feeds instead, use:
<https://apify.com/simoit/x-twitter-preset-trends-scrapper>

### Related Actors

- Need the older Explore-tab preset feeds instead of country/category global trends? Use [Trends Scraper](https://apify.com/simoit/x-twitter-preset-trends-scrapper).
- Need tweet search after spotting a trend in one market? Use [Tweet Scraper](https://apify.com/simoit/x-twitter-search-tweets-scrapper).
- Need to inspect a specific account posting in a trend? Use [Profile Scraper](https://apify.com/simoit/x-twitter-profile-scrapper).
- Need profile metadata or follower graphs for accounts discovered in the feed? Use [User Scraper](https://apify.com/simoit/x-twitter-user-scrapper).

### Input

- `country` (string, required): Country market for the global trending timeline.
- `category` (string, optional, default `all`): Category selector. Supported values:
  `all`, `anime`, `beauty`, `business_and_finance`, `cars`, `celebrity`, `cryptocurrency`, `dance`, `fashion`, `food`, `gaming`, `health_and_fitness`, `home_and_garden`, `memes`, `movies`, `music`, `nature_and_outdoors`, `news`, `pets`, `relationships`, `religion`, `science`, `sports`, `technology`, `travel`.
- `page` (integer, optional, default `1`): Starting page.
- `limit` (integer, optional, default `20`): Items per page.
- `maxPages` (integer, optional, default `1`): Number of pages to fetch starting from `page`. Example: `page=2` and `maxPages=5` fetches pages `2..6`.
- `maxItems` (integer, optional): Hard cap for pushed tweets.

### Output

A stream of current tweets from the selected global-trending feed, ready for monitoring, analysis, and downstream automation.

Note: backend endpoint returns an envelope:
`{ data: [...], page, limit, has_next, country, category }`.
This Actor pushes only tweet objects from `data[]` to the dataset.

The run also stores:

- `RUN_REPORT`
- `USER_ERROR_REPORT` when input or backend validation fails

#### Example input

```json
{
  "country": "united_states",
  "category": "all",
  "limit": 20,
  "maxItems": 50
}
```

```json
{
  "country": "egypt",
  "category": "news",
  "limit": 10,
  "maxPages": 2,
  "maxItems": 20
}
```

#### Example output

```json
{
  "id": 2040644451513598220,
  "id_str": "2040644451513598220",
  "url": "https://x.com/WhiteHouse/status/2040644451513598220",
  "date": "2026-04-05T04:15:25+00:00",
  "user": {
    "id": 1879644163769335808,
    "id_str": "1879644163769335808",
    "url": "https://x.com/WhiteHouse",
    "username": "WhiteHouse",
    "displayname": "The White House",
    "verified": false
  },
  "lang": "en",
  "rawContent": "We got him! ...",
  "replyCount": 10711,
  "retweetCount": 40062,
  "likeCount": 212756,
  "quoteCount": 4208,
  "conversationId": 2040644451513598220,
  "conversationIdStr": "2040644451513598220",
  "hashtags": [],
  "cashtags": [],
  "mentionedUsers": [],
  "links": [],
  "media": {
    "photos": [{ "url": "https://pbs.twimg.com/media/HFHTUDYaMAABWvk.jpg" }],
    "videos": [],
    "animated": []
  },
  "viewCount": 9903563,
  "_type": "snscrape.modules.twitter.Tweet"
}
```

#### Returned fields

- `id`, `id_str`: tweet identifier
- `url`: direct X post URL
- `date`: post timestamp
- `user`: embedded author object with account metadata
- `rawContent`: main tweet text
- `replyCount`, `retweetCount`, `likeCount`, `quoteCount`: engagement counters
- `conversationId`, `conversationIdStr`: conversation identifier
- `hashtags`, `cashtags`, `mentionedUsers`, `links`: extracted entities
- `media`: grouped photos, videos, and animated media
- `viewCount`: post view count when available
- `_type`: parser output type from the backend

### FAQ

**Do I need my own backend or API setup?**\
No. This Actor is ready to run on Apify, and backend infrastructure is managed by SIMO IT.

**Where do these trends come from?**\
From the newer X global-trending surface at <https://x.com/i/jf/global-trending/home>.

**Can I choose both country and category?**\
Yes. Country is required, and category is optional. Use `all` for the default feed.

**What if I want the older Explore-tab presets instead?**\
Use <https://apify.com/simoit/x-twitter-preset-trends-scrapper>.

**Can I collect more than one page?**\
Yes. Increase `maxPages` and tune `limit` and `maxItems` to fetch more results.
`maxPages` is relative to `page`, not an absolute final page number.

# Actor input Schema

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

Choose the country market for the global trending tweet timeline.

## `category` (type: `string`):

Optional global trending category. Use All for the default feed.

## `page` (type: `integer`):

Starting page number.

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

Items per page.

## `maxPages` (type: `integer`):

Number of pages to fetch starting from Page. For example page=2 and maxPages=5 fetches pages 2..6.

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

Maximum number of tweets to push.

## Actor input object example

```json
{
  "country": "united_states",
  "category": "all",
  "page": 1,
  "limit": 20,
  "maxPages": 1,
  "maxItems": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runReport` (type: `string`):

No description

## `userErrorReport` (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 = {
    "country": "united_states",
    "category": "all",
    "limit": 20,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("simoit/x-twitter-trends-scrapper").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": "united_states",
    "category": "all",
    "limit": 20,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("simoit/x-twitter-trends-scrapper").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": "united_states",
  "category": "all",
  "limit": 20,
  "maxItems": 20
}' |
apify call simoit/x-twitter-trends-scrapper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1KhnR0dB28Qeh5cuB/builds/xmONMs3rU5QlZWmOy/openapi.json
