# Baidu Tieba Conversation Graph (`contextquarry/baidu-tieba-thread-replies`) Actor

Turn public Baidu Tieba thread URLs into source-linked post and reply graph JSON for AI agents.

- **URL**: https://apify.com/contextquarry/baidu-tieba-thread-replies.md
- **Developed by:** [乾勇 胡](https://apify.com/contextquarry) (community)
- **Categories:** Social media, AI, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 tieba records

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

## Baidu Tieba Conversation Graph

Turn public Baidu Tieba thread URLs into source-linked conversation graph JSON for AI agents,
research, and Chinese-language data pipelines. This Actor accepts known public Tieba post URLs or
thread IDs and returns normalized `post` and `comment` records with parent IDs, authors,
timestamps, engagement, text, and source URLs.

### Why this Actor exists

Existing generic Tieba scrapers mostly focus on discovering posts. The useful data for AI agents,
research, market intelligence, and Chinese-language analysis often lives in the replies. This Actor
starts with the narrow job: turn one or more known Tieba thread URLs into a complete conversation
graph that downstream tools can inspect, cite, label, summarize, or route.

Use this when you already know the public Tieba thread URLs or TIDs you care about and need the
reply graph, not just the thread title or top-level post list.

### Best-fit use cases

- Build Chinese-language conversation datasets from known public threads.
- Give AI agents a bounded tool call for public Tieba discussion context.
- Preserve parent-child reply structure for research, discourse analysis, or incident review.
- Export replies from game, fandom, brand, product, or community discussions.
- Feed source-linked thread conversations into AI agents or downstream labeling pipelines.

This is not a broad social-listening tool. If you need keyword search, forum discovery, profile
scraping, monitoring, or sentiment analysis, treat that as a separate workflow after the reply
structure need is proven.

### Example input

```json
{
  "startUrls": [{ "url": "https://tieba.baidu.com/p/10673597972" }],
  "maxPostPages": 1,
  "postsPerPage": 30,
  "includeNestedComments": true,
  "maxNestedPagesPerPost": 3,
  "maxRecords": 500
}
````

### Output records

Each item has a `recordType` of `post` or `comment`.

- `post` records represent floor posts in the thread.
- `comment` records represent nested replies under a floor post.
- `pid` is the current record ID.
- `parentPid` points to the floor post for nested comments.
- `replyToUserId` is included when Tieba reports a nested reply target.

For agents, the important part is that every record keeps stable source IDs and a `sourceUrl`, so
downstream workflows can cite where a claim came from instead of treating replies as anonymous text.

Example `comment` record:

```json
{
  "recordType": "comment",
  "tid": 10673597972,
  "pid": 150000000000,
  "parentPid": 149999999999,
  "floor": 2,
  "forumId": 12345,
  "forumName": "example",
  "authorId": 987654321,
  "authorName": "tieba_user",
  "replyToUserId": 123456789,
  "nestedReplyCount": null,
  "agree": 3,
  "disagree": 0,
  "createdAtUnix": 1780000000,
  "createdAt": "2026-05-28T06:13:20+00:00",
  "isThreadAuthor": false,
  "text": "Example nested reply text",
  "sourceUrl": "https://tieba.baidu.com/p/10673597972?pid=149999999999#pid149999999999",
  "collectedAt": "2026-07-08T00:00:00+00:00"
}
```

### Pricing and cost controls

This Actor is designed for pay-per-event pricing. One `tieba-record` event represents one emitted
`post` or `comment` record. Use `maxRecords`, `maxPostPages`, and `maxNestedPagesPerPost` to cap the
run size before starting large jobs.

Each run is limited to 100 unique threads. At least one output type must be enabled: floor posts,
nested replies, or both. The Actor stops when Apify reports that the user's charge limit has been
reached.

### Scope for v1

This intentionally does not implement forum search, profile scraping, sentiment analysis, or
monitoring. Those can be added only after users prove they need complete thread replies.

Only provide public Tieba thread URLs or thread IDs. This Actor is not intended for private,
login-only, deleted, or otherwise restricted content.

# Actor input Schema

## `startUrls` (type: `array`):

Public Tieba thread URLs such as https://tieba.baidu.com/p/10673597972.

## `tids` (type: `array`):

Tieba thread IDs. Use this if you already know the numeric tid.

## `maxPostPages` (type: `integer`):

How many Tieba floor-post pages to read per thread.

## `postsPerPage` (type: `integer`):

Number of floor posts requested from each Tieba post page.

## `includeNestedComments` (type: `boolean`):

When enabled, fetch nested replies under each floor post.

## `maxNestedPagesPerPost` (type: `integer`):

Maximum number of nested-reply pages to fetch below each floor post.

## `emitFloorPosts` (type: `boolean`):

When enabled, output the main floor posts as records in addition to nested comments.

## `maxRecords` (type: `integer`):

Hard cap across posts and nested comments.

## `requestDelayMillis` (type: `integer`):

Delay between Tieba API requests. Increase this for larger runs.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://tieba.baidu.com/p/10673597972"
    }
  ],
  "tids": [
    "10673597972"
  ],
  "maxPostPages": 1,
  "postsPerPage": 30,
  "includeNestedComments": true,
  "maxNestedPagesPerPost": 3,
  "emitFloorPosts": true,
  "maxRecords": 500,
  "requestDelayMillis": 500
}
```

# Actor output Schema

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

API endpoint for the run's source-linked Tieba post and reply graph 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 = {
    "startUrls": [
        {
            "url": "https://tieba.baidu.com/p/10673597972"
        }
    ],
    "tids": [
        "10673597972"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("contextquarry/baidu-tieba-thread-replies").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 = {
    "startUrls": [{ "url": "https://tieba.baidu.com/p/10673597972" }],
    "tids": ["10673597972"],
}

# Run the Actor and wait for it to finish
run = client.actor("contextquarry/baidu-tieba-thread-replies").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 '{
  "startUrls": [
    {
      "url": "https://tieba.baidu.com/p/10673597972"
    }
  ],
  "tids": [
    "10673597972"
  ]
}' |
apify call contextquarry/baidu-tieba-thread-replies --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=contextquarry/baidu-tieba-thread-replies",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Baidu Tieba Conversation Graph",
        "description": "Turn public Baidu Tieba thread URLs into source-linked post and reply graph JSON for AI agents.",
        "version": "0.1",
        "x-build-id": "qDJvMkhac7CeaGcJ9"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/contextquarry~baidu-tieba-thread-replies/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-contextquarry-baidu-tieba-thread-replies",
                "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/contextquarry~baidu-tieba-thread-replies/runs": {
            "post": {
                "operationId": "runs-sync-contextquarry-baidu-tieba-thread-replies",
                "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/contextquarry~baidu-tieba-thread-replies/run-sync": {
            "post": {
                "operationId": "run-sync-contextquarry-baidu-tieba-thread-replies",
                "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",
                "properties": {
                    "startUrls": {
                        "title": "Tieba post URLs",
                        "maxItems": 100,
                        "type": "array",
                        "description": "Public Tieba thread URLs such as https://tieba.baidu.com/p/10673597972.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "tids": {
                        "title": "Thread IDs",
                        "maxItems": 100,
                        "type": "array",
                        "description": "Tieba thread IDs. Use this if you already know the numeric tid.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPostPages": {
                        "title": "Maximum floor-post pages per thread",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "How many Tieba floor-post pages to read per thread.",
                        "default": 1
                    },
                    "postsPerPage": {
                        "title": "Floor posts per page",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Number of floor posts requested from each Tieba post page.",
                        "default": 30
                    },
                    "includeNestedComments": {
                        "title": "Include nested replies",
                        "type": "boolean",
                        "description": "When enabled, fetch nested replies under each floor post.",
                        "default": true
                    },
                    "maxNestedPagesPerPost": {
                        "title": "Maximum nested-reply pages per floor post",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum number of nested-reply pages to fetch below each floor post.",
                        "default": 3
                    },
                    "emitFloorPosts": {
                        "title": "Emit floor posts",
                        "type": "boolean",
                        "description": "When enabled, output the main floor posts as records in addition to nested comments.",
                        "default": true
                    },
                    "maxRecords": {
                        "title": "Maximum output records",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Hard cap across posts and nested comments.",
                        "default": 500
                    },
                    "requestDelayMillis": {
                        "title": "Delay between requests",
                        "minimum": 0,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Delay between Tieba API requests. Increase this for larger runs.",
                        "default": 500
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
