# X (Twitter) Community Search Post Scraper  𝕏 (`api-ninja/x-twitter-community-search-post-scraper`) Actor

Extract tweets from X (Twitter) communities. Process single or multiple communities, get comprehensive tweet data with community context, and handle large-scale data collection efficiently.

- **URL**: https://apify.com/api-ninja/x-twitter-community-search-post-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Social media, Integrations, Automation
- **Features:** Limited permissions
- **Stats:** 416 total users, 31 monthly users, 98.9% runs succeeded, 42 bookmarks
- **User rating**: 4.96 out of 5 stars

## Pricing

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

## X (Twitter) Community Tweets Scraper

**Extract tweets, media, and engagement data from any X (Twitter) Community. Support for multiple communities, pagination, and sorting options.**

***

### What does X (Twitter) Community Tweets Scraper do?

**X (Twitter) Community Tweets Scraper** is a powerful Apify Actor designed to **scrape X (Twitter) Communities** without needing the official Twitter API. It allows you to extract public posts, media, and engagement metrics from niche communities on X, delivering the data in structured formats like **JSON, CSV, Excel, or HTML**.

This is a **no-code** tool suitable for everyone—from developers to marketers. It handles complex tasks like pagination, rate limiting, and proxy management automatically, so you can focus on the data. It is the perfect tool to **download X Community data** for analysis.

#### Who is this for?

- **Researchers**: Analyzing social groups, public discourse, and niche topics.
- **Marketers**: Tracking community sentiment, trends, and influencer activity.
- **Data Analysts**: Building datasets for NLP, sentiment analysis, or social science research.
- **Businesses**: Monitoring brand mentions and feedback within specific communities.

### Use Cases for X (Twitter) Community Data

- **Sentiment Analysis**: Gauge how specific communities feel about topics, products, or events.
- **Trend Monitoring**: Identify emerging trends and viral content within niche groups before they hit the mainstream.
- **Lead Generation**: Find active users and potential leads discussing relevant topics in specialized communities.
- **Content Strategy**: Analyze top-performing posts to understand what resonates with specific audiences.
- **Academic Research**: Collect large-scale datasets for sociological or political studies.

### Features of X (Twitter) Community Tweets Scraper

This tool is built for flexibility and scale. Here is what makes it powerful:

- **👥 Scrape Multiple Communities**: Enter a list of Community IDs to scrape them all in a single run.
- **↕️ Flexible Sorting**: Sort tweets by **Latest** (real-time monitoring) or **Top** (most popular/viral content).
- **🔄 Deep Pagination**: Automatically scrolls through the timeline to collect hundreds or thousands of tweets.
- **♾️ Scrape All Mode**: Enable "Scrape All" to retrieve every available tweet from the community timeline.
- **📊 Rich Metadata**: Extracts tweet text, author details, like/retweet counts, media URLs, and timestamps.
- **🆔 Context Preserved**: Every scraped tweet is tagged with its source `communityId`, making it easy to organize data from multiple sources.

#### The Apify Platform Advantage

Using this Actor on the Apify platform gives you enterprise-grade benefits:

- **Full API Access**: Integrate the scraper programmatically into your existing pipelines.
- **Integrations**: Push data directly to **Google Sheets**, **Slack**, **Zapier**, **Make**, or via webhooks.
- **Proxy Rotation**: Automatic handling of IP rotation and residential proxies to prevent blocking.
- **Scheduling**: Set up cron jobs to monitor communities daily, hourly, or weekly.
- **Cloud Storage**: Long-term retention of your datasets in the secure Apify cloud.

### What data can I extract?

The scraper provides comprehensive data for every tweet. Here are the main data points:

| Field | Description |
|-------|-------------|
| `full_text` | The actual text content of the tweet. |
| `created_at` | The exact date and time the tweet was posted. |
| `favorite_count` | Number of likes/hearts. |
| `retweet_count` | Number of retweets. |
| `reply_count` | Number of replies. |
| `user` | Object containing author details (screen name, name, profile image). |
| `media` | Links to images or videos attached to the tweet. |
| `communityId` | The ID of the community this tweet belongs to. |
| `views` | View count (impression metrics). |

### How to scrape X (Twitter) Communities

Getting started is easy and requires no programming skills.

1. **Find the Community ID**: Visit a community on X (e.g., [Twitter Communities](https://twitter.com/communities)). The **Community ID** is the long number at the end of the URL (e.g., in `https://twitter.com/i/communities/1472105760389668865`, the ID is `1472105760389668865`).
2. **Input the ID**: Copy that number and paste it into the **Community IDs** field in the Actor input. You can add multiple IDs to scrape them simultaneously.
3. **Choose Sorting**: Select **Latest** to see what's happening now, or **Top** to see the best content.
4. **Set Limits**: Choose how many tweets you want (e.g., 100) or enable **Scrape All** to get everything available.
5. **Run**: Click the **Start** button.

### Pricing

This Actor uses **pay-per-event pricing** with a **$0.10 minimum total charge per run**.

| Charge | Free plan | Bronze-Diamond plans |
| --- | ---: | ---: |
| Actor start | $0.01 | $0.01 |
| Result saved to the default dataset | $0.01 per result | $0.00035 per result |

The Actor start event is charged once per GB of memory, with at least one event per run. The final cost depends mainly on how many community-post records are saved. Start with one community and a small tweet limit, then check the Actor's **Pricing** tab for the latest rates before starting a large run.

### Input and Output Examples

#### Input

For a full list of input options, see the **Input tab** in Apify Console.

```json
{
  "communityIds": [
    "1472105760389668865",
    "1567890123456789012"
  ],
  "sortBy": "Latest",
  "numberOfTweets": 100,
  "scrapeAll": false
}
```

#### Output

The results are delivered in a structured JSON format. **You can download the dataset in JSON, CSV, Excel, XML, HTML, or RSS, or access it via API.**

```json
[
  {
    "created_at": "Fri Feb 01 12:00:00 +0000 2026",
    "id_str": "1885829471029384756",
    "full_text": "Just discovered a great new feature in Python! #coding #community",
    "user": {
      "id_str": "12345678",
      "name": "Python Fan",
      "screen_name": "python_fan_123"
    },
    "favorite_count": 42,
    "retweet_count": 5,
    "communityId": "1472105760389668865"
  }
]
```

### Other X (Twitter) Scraping Tools

If you like this Actor, you might also find these X (Twitter) tools useful:

- 🔎 **[X (Twitter) Advanced Search](https://apify.com/api-ninja/x-twitter-advanced-search)**: Discover posts using keywords, accounts, dates, engagement, media, and advanced operators.
- 💬 **[X (Twitter) Replies & Retweets Scraper](https://apify.com/api-ninja/x-twitter-replies-retweets-scraper)**: Collect replies, retweets, and detailed information for known posts.
- 👥 **[X (Twitter) Followers Scraper](https://apify.com/api-ninja/x-twitter-followers-scraper)**: Export followers, following, list members, and community members.
- 👤 **[X (Twitter) Profile Scraper](https://apify.com/api-ninja/x-twitter-profile-scraper)**: Extract public profile information, posts, followers, following, and affiliates.

### FAQ and Legal

#### Is it legal to scrape X (Twitter)?

Our scrapers are designed to collect only **publicly available data**. We do not extract private user data (such as email addresses, gender, or location) unless it is publicly shared by the user. We believe that our scrapers, when used for ethical purposes by Apify users, are safe. However, you should not scrape personal data unless you have a legitimate reason to do so. If you're unsure, consult your legal advisors.

#### Do I need a Twitter API Key?

No! This Actor handles all the authentication and scraping logic for you. You just need an Apify account.

#### Why are the results sorted differently than I see on the web?

The "Top" and "Latest" algorithms on X can vary slightly based on personalization. Our scraper fetches data directly from the community endpoints to give you the most raw and unfiltered view possible based on your selected sort order.

#### Support

If you encounter any bugs, have feature requests, or need a custom scraping solution, please create an issue in the **Issues** tab or reach out to us directly.

# Actor input Schema

## `communityIds` (type: `array`):

Enter the numeric Community IDs of X (Twitter) communities you want to scrape tweets from. Each Community ID is a 19-digit number (e.g., '1472105760389668865'). You can find Community IDs in the URL when visiting a community page on X/Twitter or by using X's API. Add multiple IDs to scrape several communities in a single run.

## `sortBy` (type: `string`):

Sort order for tweets.

## `numberOfTweets` (type: `integer`):

Specify the maximum number of tweets to collect from EACH community. Scraper will collect up to this many tweets, paginating if necessary.

## `scrapeAll` (type: `boolean`):

When enabled, scrapes all tweets found for each community, ignoring the per-community limit.

## Actor input object example

```json
{
  "communityIds": [
    "1472105760389668865"
  ],
  "sortBy": "Latest",
  "numberOfTweets": 100,
  "scrapeAll": false
}
```

# Actor output Schema

## `results` (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 = {
    "communityIds": [
        "1472105760389668865"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/x-twitter-community-search-post-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 = { "communityIds": ["1472105760389668865"] }

# Run the Actor and wait for it to finish
run = client.actor("api-ninja/x-twitter-community-search-post-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 '{
  "communityIds": [
    "1472105760389668865"
  ]
}' |
apify call api-ninja/x-twitter-community-search-post-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-ninja/x-twitter-community-search-post-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/upbwCMnBATzmzcaNu/builds/96e8T10ldBPBuJAqI/openapi.json
