# Twitter/X Community Scraper: Search, Members, Tweets & More! (`scrape.badger/twitter-community-scraper`) Actor

This Twitter (X) scraping actor is designed to extract communities information: tweets, members, moderators, search for different communities, get communities tweets.

- **URL**: https://apify.com/scrape.badger/twitter-community-scraper.md
- **Developed by:** [Scrape Badger](https://apify.com/scrape.badger) (community)
- **Categories:** Social media, Developer tools, Other
- **Stats:** 27 total users, 6 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.20 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

### ScrapeBadger: Twitter/X Communities Scraper - Extract Community Data, Members, Tweets, and More!

[![Scrapebadger Twitter Scraper](https://raw.githubusercontent.com/ScrapeBadger/twitter-scraper/refs/heads/main/scrapebadger.png)](https://scrapebadger.com)

ScrapeBadger provides powerful data extraction capabilities to scrape Twitter/X Communities, offering an incredibly affordable solution for comprehensive community data collection. Extract community details, members, moderators, tweets, and search for communities by keyword. All this starts at just **$0.20 per 1,000 results.**

Twitter Communities are groups where users with shared interests connect and discuss specific topics. With ScrapeBadger's Communities Scraper, you can analyze these communities for market research, competitor analysis, influencer identification, and audience segmentation.

#### Key Features

* **Effortless Operation:** Designed for **ease of use**, ScrapeBadger requires you to **select a Mode and provide its corresponding identifier** (e.g., Community ID for "Get Community Detail", search query for "Search Communities").
* **Comprehensive Community Data:**
    * **Get Community Detail** - Fetch metadata including name, description, member count, rules, and admin info.
    * **Get Community Members** - Extract all members of a community with their profiles.
    * **Get Community Moderators** - Identify moderators and admins of a community.
    * **Get Community Tweets** - Retrieve tweets posted within a community (Top, Latest, or Media).
* **Powerful Search:**
    * **Search Communities** - Find communities by keyword to discover relevant groups.
    * **Search Community Tweets** - Search for specific content within a community.
* **Flexible and Structured Output:** Data is delivered in Apify's standard Dataset, ready for export in CSV, JSON, etc.
* **Enterprise-Grade Reliability:** Built on the robust Apify platform for consistent results.
* **Cost-Effective Solution:** Just **$0.20 per 1,000 results**.

#### Great For

* **Market Research:** Discover communities discussing your products, services, or industry.
* **Competitor Analysis:** Monitor competitor communities and their engagement.
* **Community Management:** Analyze successful communities to inform your own strategy.
* **Influencer Identification:** Find key members and moderators in relevant communities.
* **Content Strategy:** Understand what topics and content resonate within communities.
* **Academic Research:** Study online community dynamics and behaviors.

#### How to Use - Mode-Specific Input Parameters

| Mode | Description | Key Input Parameter | JSON Parameter | Optional |
|:-----|:------------|:--------------------|:---------------|:---------|
| Get Community Detail | Get metadata for a specific community | **Community ID** | `community_id` | - |
| Get Community Members | Extract all members of a community | **Community ID** | `community_id` | `max_results` |
| Get Community Moderators | Get moderators/admins of a community | **Community ID** | `community_id` | `max_results` |
| Get Community Tweets | Get tweets posted in a community | **Community ID** | `community_id` | `tweet_type`, `max_results` |
| Search Communities | Find communities by keyword | **Search Query** | `query` | `max_results` |
| Search Community Tweets | Search tweets within a community | **Community ID**, **Query** | `community_id`, `query` | `max_results` |

#### Request and Response Examples

##### 1. Get Community Detail

**Request:**
```json
{
  "mode": "Get Community Detail",
  "community_id": "1494465737469038594"
}
````

**Response:**

```json
{
  "id": "1494465737469038594",
  "name": "Crypto Community",
  "description": "A community for crypto enthusiasts...",
  "member_count": 15000,
  "created_at": "2022-02-17T18:00:00+00:00",
  "is_nsfw": false,
  "join_policy": "Open",
  "admin_username": "community_admin",
  "rules": [
    {"name": "Be respectful", "description": "..."}
  ]
}
```

##### 2. Get Community Members

**Request:**

```json
{
  "mode": "Get Community Members",
  "community_id": "1494465737469038594",
  "max_results": 500
}
```

**Response (array of community members):**

```json
{
  "user": {
    "id": "12345678",
    "username": "member_user",
    "name": "Member Name",
    "followers_count": 500
  },
  "role": "Member",
  "joined_at": "2023-05-15T10:00:00+00:00"
}
```

##### 3. Get Community Moderators

**Request:**

```json
{
  "mode": "Get Community Moderators",
  "community_id": "1494465737469038594",
  "max_results": 50
}
```

##### 4. Get Community Tweets

**Request:**

```json
{
  "mode": "Get Community Tweets",
  "community_id": "1494465737469038594",
  "tweet_type": "Latest",
  "max_results": 1000
}
```

**Tweet Type Options:**

- `Top` - Most popular/engaging tweets (default)
- `Latest` - Most recent tweets
- `Media` - Tweets containing images/videos

##### 5. Search Communities

**Request:**

```json
{
  "mode": "Search Communities",
  "query": "cryptocurrency",
  "max_results": 100
}
```

**Response (array of communities):**

```json
{
  "id": "1494465737469038594",
  "name": "Crypto Traders",
  "description": "Community for crypto trading...",
  "member_count": 8500,
  "is_nsfw": false
}
```

##### 6. Search Community Tweets

**Request:**

```json
{
  "mode": "Search Community Tweets",
  "community_id": "1494465737469038594",
  "query": "bitcoin price",
  "max_results": 200
}
```

#### Output Fields

**Community objects include:**

- **Core:** id, name, description
- **Membership:** member\_count, is\_member, role
- **Settings:** is\_nsfw, join\_policy, invites\_policy
- **Metadata:** created\_at
- **Administration:** creator\_id, creator\_username, admin\_id, admin\_username
- **Rules:** rules (list of community rules)

**Community Member objects include:**

- **User:** Full user profile data
- **Role:** Member, Moderator, or Admin
- **Joined:** Date joined the community

**Tweet objects include:**

- **Core:** id, text, created\_at, lang
- **Engagement:** favorite\_count, retweet\_count, reply\_count, view\_count
- **Author:** user\_id, username

**Important Note:** To prevent API abuse and ensure fair resource allocation, you will be charged for requests that return an empty results set.

#### Why Choose ScrapeBadger?

- **Highly Targeted Data:** Get precisely the Twitter/X community data you need.
- **Efficient and Reliable:** Built for speed and stability on the Apify platform.
- **Unbeatable Value:** Just $0.20 per 1,000 results.
- **User-Friendly:** Easy to configure regardless of technical expertise.
- **Seamless Integration:** Output data readily available for analysis.

#### About ScrapeBadger

This actor is powered by [ScrapeBadger](https://scrapebadger.com) - a reliable Twitter/X data extraction service.

- **Official Website:** [scrapebadger.com](https://scrapebadger.com)
- **Faster Support:** Get priority support directly through the ScrapeBadger website
- **SDK & API Access:** Want to use ScrapeBadger outside of Apify? The Python SDK and REST API are available for direct integration into your own applications

# Actor input Schema

## `mode` (type: `string`):

Select the type of community data to scrape. Each mode requires different input parameters.

## `community_id` (type: `string`):

The numeric Community ID from the URL. From https://x.com/i/communities/<b>1494465737469038594</b>, enter <b>1494465737469038594</b>. Required for community-specific modes.

## `query` (type: `string`):

Keywords to search for communities or tweets within a community. Example: <b>crypto</b> or <b>AI developers</b>. Required for search modes.

## `tweet_type` (type: `string`):

Type of tweets to retrieve. <b>Top</b> shows popular tweets, <b>Latest</b> shows recent tweets, <b>Media</b> shows tweets with images/videos. Used for 'Get Community Tweets' mode.

## `max_results` (type: `integer`):

Maximum number of items to return. Higher values increase run time and cost. Default: 1000.

## Actor input object example

```json
{
  "mode": "Get Community Detail",
  "community_id": "1494465737469038594",
  "query": "crypto",
  "tweet_type": "Top",
  "max_results": 1000
}
```

# Actor output Schema

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

All scraped data including user profiles, tweets, and status indicators stored in the default dataset

# 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 = {
    "community_id": "1494465737469038594",
    "query": "crypto"
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrape.badger/twitter-community-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 = {
    "community_id": "1494465737469038594",
    "query": "crypto",
}

# Run the Actor and wait for it to finish
run = client.actor("scrape.badger/twitter-community-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 '{
  "community_id": "1494465737469038594",
  "query": "crypto"
}' |
apify call scrape.badger/twitter-community-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Twitter/X Community Scraper: Search, Members, Tweets & More!",
        "description": "This Twitter (X) scraping actor is designed to extract communities information: tweets, members, moderators, search for different communities, get communities tweets.",
        "version": "1.0",
        "x-build-id": "5zL2Uw12f7SGfjX0z"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrape.badger~twitter-community-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrape.badger-twitter-community-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrape.badger~twitter-community-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrape.badger-twitter-community-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrape.badger~twitter-community-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrape.badger-twitter-community-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "Get Community Detail",
                            "Get Community Members",
                            "Get Community Moderators",
                            "Get Community Tweets",
                            "Search Communities",
                            "Search Community Tweets"
                        ],
                        "type": "string",
                        "description": "Select the type of community data to scrape. Each mode requires different input parameters.",
                        "default": "Get Community Detail"
                    },
                    "community_id": {
                        "title": "Community ID",
                        "type": "string",
                        "description": "The numeric Community ID from the URL. From https://x.com/i/communities/<b>1494465737469038594</b>, enter <b>1494465737469038594</b>. Required for community-specific modes."
                    },
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Keywords to search for communities or tweets within a community. Example: <b>crypto</b> or <b>AI developers</b>. Required for search modes."
                    },
                    "tweet_type": {
                        "title": "Tweet Type",
                        "enum": [
                            "Top",
                            "Latest",
                            "Media"
                        ],
                        "type": "string",
                        "description": "Type of tweets to retrieve. <b>Top</b> shows popular tweets, <b>Latest</b> shows recent tweets, <b>Media</b> shows tweets with images/videos. Used for 'Get Community Tweets' mode.",
                        "default": "Top"
                    },
                    "max_results": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Maximum number of items to return. Higher values increase run time and cost. Default: 1000.",
                        "default": 1000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
