# X(Twitter) Popular Communities Scraper (`powerai/twitter-popular-community-scraper`) Actor

Discover popular X Communities by topic—names, rules, member counts, and rich Community objects in structured rows.

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

## X Popular Communities Scraper

Browse **popular X Communities** for a chosen **topic**—the same kind of spaces people discover when exploring Communities by category. Each dataset row is one Community with nested details such as name, description, rules, member counts, banners, themes, facepile members, and admin or creator profiles when returned.

### Who it’s for

- **Community managers & moderators** researching active spaces in a theme.
- **Marketers & analysts** mapping topic ecosystems on X.
- **Researchers** who want structured exports instead of manual browsing.

### What you can do with it

- **Pick a topic id** that matches a Community category (for example technology or hobby topics exposed in the product).
- **Collect many Communities** in one run until you reach the limit you set or there are no more results.
- **Match every row** to the topic you asked for via **`requestedTopicId`**, plus **`scrapedAt`** on each row.

### How it works (in plain terms)

You enter the **topic id** (the same identifier used when X groups Communities by topic). The tool loads results in successive batches until your **maximum row count** is reached or the list ends—you do not need to manage paging yourself.

### Input

| Field | Required | What it means |
|-------|----------|----------------|
| **Topic ID** (`topicId`) | Yes | Which topic’s popular Communities to list. |
| **Maximum results** (`maxResults`) | No | Upper limit on how many community rows to collect (default **50**). |

### Output

- **One row per Community** (until your cap). Rows are often **large** (hundreds of lines of JSON when fully expanded).
- **Identity & basics**: **`__typename`** (`Community`), **`name`**, **`description`**, **`access`**, numeric **`rest_id`**, **`created_at`** (epoch-style when returned), **`question`**, **`role`** (e.g. viewer vs member), **`is_nsfw`**, **`is_pinned`**.
- **Scale & activity**: **`member_count`**, **`moderator_count`**, **`new_tweet_count_since_last_viewed`**.
- **Topic tag**: **`primary_community_topic`** with **`topic_id`** and **`topic_name`**.
- **Policies & invites**: **`join_policy`**, **`join_requests_result`**, **`invites_policy`**, **`invites_result`**.
- **Presentation**: **`custom_theme`**, **`default_theme`**, **`custom_banner_media`** and **`default_banner_media`** (imagery, palettes, **`media_key`**).
- **Discovery helpers**: **`search_tags`**, **`trending_hashtags_slice`** (often an **`items`** array, sometimes empty).
- **Rules**: **`rules`** entries can include **`name`**, optional **`description`**, **`rest_id`**.
- **Actions**: **`actions`** (`CommunityActions`) may expose join/leave/spotlight-style results.
- **People**: **`admin_results`** and **`creator_results`** embed **`User`** objects with rich **`legacy`** profiles; **`members_facepile_results`** lists sample members the same way.
- **Export metadata**: **`requestedTopicId`** repeats the topic you entered; **`scrapedAt`** is when that row was saved.

Optional sections vary by Community; some fields appear only in certain contexts. Details may change as X updates its product.

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

The snippet below uses field names and values from a real run; nested user and media blocks are omitted or shortened.

```json
{
  "__typename": "Community",
  "access": "Public",
  "actions": {
    "__typename": "CommunityActions",
    "community_spotlight_setup_action_result": {
      "__typename": "CommunitySpotlightSetupActionShow",
      "deeplink": "twitter://profile_spotlight"
    },
    "join_action_result": { "__typename": "CommunityJoinAction" },
    "leave_action_result": {
      "__typename": "CommunityLeaveActionUnavailable",
      "message": "Not a member.",
      "reason": "ViewerNotMember"
    }
  },
  "created_at": 1670743786266,
  "custom_theme": "Red",
  "default_theme": "Plum",
  "description": "Share AI-generated creations, news, tips and more. Sponsored by @higgsfield",
  "invites_policy": "MemberInvitesAllowed",
  "is_nsfw": false,
  "join_policy": "Open",
  "member_count": 245954,
  "moderator_count": 14,
  "name": "Generative AI",
  "new_tweet_count_since_last_viewed": 0,
  "primary_community_topic": {
    "topic_id": "302",
    "topic_name": "Artificial Intelligence"
  },
  "question": "",
  "rest_id": "1601841656147345410",
  "role": "NonMember",
  "rules": [
    {
      "description": "Harassment, bullying, or toxic behavior won’t be tolerated.",
      "name": "Be kind and respectful.",
      "rest_id": "1831180873569333471"
    }
  ],
  "search_tags": ["generative", "ai", "midjourney", "chatgpt"],
  "trending_hashtags_slice": { "items": [] },
  "requestedTopicId": "302",
  "scrapedAt": "2026-03-26T01:01:07.161Z"
}
```

`admin_results`, `creator_results`, `members_facepile_results`, and full banner media trees are omitted here but appear in full dataset rows.

### Good to know

- The **topic id** must match a topic X recognizes; unknown ids may return few or no rows.
- Respect X’s rules and applicable laws when using exported data.

# Actor input Schema

## `topicId` (type: `string`):

The id of the Community topic to browse (for example Artificial Intelligence). Use the same id you see when picking a topic in X’s Community topic list.

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

How many community rows to save in total.

## Actor input object example

```json
{
  "topicId": "302",
  "maxResults": 10
}
```

# 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 = {
    "topicId": "302",
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("powerai/twitter-popular-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 = {
    "topicId": "302",
    "maxResults": 10,
}

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/an4MhVGuF1Du7F7UT/builds/Y7a4IpIw2NlQVL3E8/openapi.json
