# X(Twitter) Community Posts Scraper (`powerai/twitter-community-tweets-scraper`) Actor

Collect posts from an X Community feed—text, media, and engagement—into structured rows for research or reporting.

- **URL**: https://apify.com/powerai/twitter-community-tweets-scraper.md
- **Developed by:** [PowerAI](https://apify.com/powerai) (community)
- **Categories:** Social media, Videos, Integrations
- **Stats:** 2 total users, 1 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/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

## X Community Posts Scraper

Gather **posts from an X (Twitter) Community**—the same kinds of items people see in that Community’s feed—into dataset rows. Each row is one post with nested text, media, author, Community context, and engagement details when available.

### Who it’s for

- **Community managers** reviewing what is being shared in a space they run.  
- **Researchers & analysts** who need exports instead of manual scrolling.  
- **Social & comms** teams tracking conversations around a topic or brand Community.

### What you can do with it

- **Collect many posts** in one run until you reach the limit you set or there is nothing more to load.  
- **Choose how the feed is presented** (standard stream vs. one that emphasizes photos and video).  
- **Optionally influence ordering** when the product exposes sort options (relevance, newest, or likes).  
- **Match rows to your inputs** via **`communityId`**, **`searchType`**, and optional **`rankingMode`** on each row, plus **`scrapedAt`**.

### How it works (in plain terms)

You enter the **Community’s numeric id** (the same id you see in the Community’s URL or similar places). You also pick **which feed view** to use and, if you want, a **sort order**. The tool loads posts in successive batches until your **maximum** is reached or the feed ends—you do not need to manage paging yourself.

### Input

| Field | Required | What it means |
|-------|----------|----------------|
| **Community ID** (`communityId`) | Yes | Which Community’s posts to export. |
| **Feed type** (`searchType`) | Yes | Regular community stream (**Default**) or a media-focused stream (**Media**). |
| **Sort order** (`rankingMode`) | No | When available: **Relevance**, **Recency**, or **Likes**. |
| **Maximum results** (`maxResults`) | No | Upper limit on how many post rows to collect (default **50**). |

### Output

Each dataset row combines the **post payload** with a few **export fields** you chose at run time.

- **Post identity & surface fields**: **`__typename`**, **`rest_id`**, posting **`source`**, **`views`** (count and state when shown), **`edit_control`** when edits apply, and flags such as **`is_translatable`** when present.  
- **Community context (author)**: **`author_community_relationship`** bundles the poster’s relationship to the Community (**`role`**, e.g. Member), the author under **`user_results`**, and a rich **`community_results`** snapshot—Community **name**, **description**, **member_count**, **rules**, banner imagery, **members_facepile_results**, admin/creator highlights, join policies, and similar nested details when returned.  
- **Lighter Community pointers**: **`community_relationship`** (e.g. moderation/pin-related hints) and **`community_results`** with **`id_str`** and viewer relationship blocks.  
- **Author (standard tweet core)**: **`core.user_results`** with profile **`legacy`** fields (**`screen_name`**, **`name`**, avatars, counts, **`entities`**, etc.).  
- **Content & engagement**: **`legacy`** holds **`full_text`**, **`created_at`**, **`conversation_id_str`**, **`entities`** / **`extended_entities`** (photos, videos with **`video_info.variants`**, etc.), and counters such as favorites, reposts, replies, quotes, bookmarks; plus **`is_quote_status`**, **`quoted_status_id_str`**, and **`quoted_status_permalink`** when the post quotes another.  
- **Quoted post body**: when present, **`quoted_status_result.result`** repeats a full nested post (same general shape—**`core`**, **`legacy`**, **`views`**, optional Community **`community_results`**, and further nesting such as another quoted tweet inside).  
- **Export metadata** (added per row): **`communityId`**, **`searchType`**, optional **`rankingMode`**, **`scrapedAt`**.

Rows are often **very large**; field names and nesting mirror what X returns for Community timelines and may change over time.

#### Sample output (one dataset row, heavily trimmed)

The snippet below keeps real field names from a typical row but omits most nested objects and long strings.

```json
{
  "__typename": "Tweet",
  "rest_id": "2036575486533575164",
  "author_community_relationship": {
    "community_results": {
      "result": {
        "__typename": "Community",
        "name": "Generative AI",
        "description": "Share AI-generated creations, news, tips and more.",
        "member_count": 245906,
        "id_str": "1601841656147345410"
      }
    },
    "role": "Member",
    "user_results": {
      "result": {
        "__typename": "User",
        "rest_id": "2030621483081617408",
        "legacy": {
          "screen_name": "Magical_idol8",
          "name": "まほアカプレミア"
        }
      }
    }
  },
  "community_relationship": {
    "rest_id": "2036575486533575164"
  },
  "community_results": {
    "result": {
      "__typename": "Community",
      "id_str": "1601841656147345410"
    }
  },
  "core": {
    "user_results": {
      "result": {
        "__typename": "User",
        "rest_id": "2030621483081617408",
        "legacy": {
          "screen_name": "Magical_idol8",
          "name": "まほアカプレミア"
        }
      }
    }
  },
  "edit_control": {
    "edit_tweet_ids": ["2036575486533575164"],
    "is_edit_eligible": false
  },
  "legacy": {
    "created_at": "Tue Mar 24 22:46:48 +0000 2026",
    "full_text": "おはようございます！…",
    "conversation_id_str": "2036575486533575164",
    "favorite_count": 104,
    "retweet_count": 49,
    "reply_count": 43,
    "quote_count": 8,
    "is_quote_status": true,
    "quoted_status_id_str": "2036214605626875983"
  },
  "quoted_status_result": {
    "result": {
      "__typename": "Tweet",
      "rest_id": "2036214605626875983",
      "legacy": {
        "full_text": "おはようございます！…",
        "favorite_count": 222
      }
    }
  },
  "source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
  "views": {
    "count": "8287",
    "state": "EnabledWithCount"
  },
  "communityId": "1601841656147345410",
  "searchType": "Default",
  "rankingMode": "Relevance",
  "scrapedAt": "2026-03-25T09:15:09.894Z"
}
````

### Good to know

- The **Community id** must be correct; private or restricted Communities may return few or no rows.
- **Pinned** content may also appear in the main list—duplicates are reduced when possible, but always validate in your own pipeline if you need strict uniqueness.
- Respect X’s rules and applicable laws when using exported data.

# Actor input Schema

## `communityId` (type: `string`):

The numeric id of the X Community whose posts you want to collect.

## `searchType` (type: `string`):

Which view of the Community feed to use: the regular stream, or one that prioritizes posts with photos or video.

## `rankingMode` (type: `string`):

Optional. How to order posts when the product supports it—by relevance, newest first, or most liked.

## `maxResults` (type: `integer`):

How many post rows to save in total.

## Actor input object example

```json
{
  "communityId": "1601841656147345410",
  "searchType": "Default",
  "maxResults": 18
}
```

# 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 = {
    "communityId": "1601841656147345410",
    "searchType": "Default",
    "maxResults": 18
};

// Run the Actor and wait for it to finish
const run = await client.actor("powerai/twitter-community-tweets-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 = {
    "communityId": "1601841656147345410",
    "searchType": "Default",
    "maxResults": 18,
}

# Run the Actor and wait for it to finish
run = client.actor("powerai/twitter-community-tweets-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 '{
  "communityId": "1601841656147345410",
  "searchType": "Default",
  "maxResults": 18
}' |
apify call powerai/twitter-community-tweets-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "X(Twitter) Community Posts Scraper",
        "description": "Collect posts from an X Community feed—text, media, and engagement—into structured rows for research or reporting.",
        "version": "0.0",
        "x-build-id": "aic6xvA1B4610PaGt"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/powerai~twitter-community-tweets-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-powerai-twitter-community-tweets-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/powerai~twitter-community-tweets-scraper/runs": {
            "post": {
                "operationId": "runs-sync-powerai-twitter-community-tweets-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/powerai~twitter-community-tweets-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-powerai-twitter-community-tweets-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": [
                    "communityId",
                    "searchType"
                ],
                "properties": {
                    "communityId": {
                        "title": "Community ID",
                        "type": "string",
                        "description": "The numeric id of the X Community whose posts you want to collect.",
                        "default": "1601841656147345410"
                    },
                    "searchType": {
                        "title": "Feed type",
                        "enum": [
                            "Default",
                            "Media"
                        ],
                        "type": "string",
                        "description": "Which view of the Community feed to use: the regular stream, or one that prioritizes posts with photos or video.",
                        "default": "Default"
                    },
                    "rankingMode": {
                        "title": "Sort order",
                        "enum": [
                            "Relevance",
                            "Recency",
                            "Likes"
                        ],
                        "type": "string",
                        "description": "Optional. How to order posts when the product supports it—by relevance, newest first, or most liked."
                    },
                    "maxResults": {
                        "title": "Maximum results",
                        "minimum": 18,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "How many post rows to save in total.",
                        "default": 18
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
