# Hupu Scraper (`crawlerbros/hupu-scraper`) Actor

Scrape 虎扑社区 (bbs.hupu.com) without login - forum board threads, hot threads, and thread pages with author, board, reply/view counts and the first page of comments.

- **URL**: https://apify.com/crawlerbros/hupu-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Agents, Automation, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

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

## Hupu Scraper

Scrapes [虎扑社区](https://bbs.hupu.com/) (Hupu, China's largest sports forum) — **without login** — from the SSR forum pages.

### Data source

Threads and comments come from Hupu's public web pages/APIs (bbs.hupu.com) — no login, no API key. See the Notes section for board-slug and comment-pagination caveats.

### What it does

| Mode | URL pattern | Output |
|---|---|---|
| `byBoard` | `bbs.hupu.com/{board}` + `{board}-{page}` | Board thread list (title, replies/views, author, time) |
| `hot` | `bbs.hupu.com/hot` | Hot threads (title, lights, replies, board) |
| `byThreadUrl` | `bbs.hupu.com/{tid}.html` | Full thread: content snippet, stats, author, board, first 20 comments |

All pages verified live (HTTP 200 with real 虎扑 content) from a datacenter network. Thread pages embed the full payload in a `__NEXT_DATA__` JSON script tag — no JS execution needed.

### Output fields

**thread records (`recordType: "thread"`)** — `threadId`, `title`, `contentSnippet`, `contentLength`, `lightCount`, `replyCount`, `viewCount`, `recommendCount`, `createdAtMs`, `createdAtText`, `repliedAtMs`, `author`, `authorId`, `authorUrl`, `authorLevel`, `authorAvatarUrl`, `board`, `boardUrl`, `boardThreadCount`, `topicId`, `client`, `location`, `contentType`, `hasVideo`, `videoCover`, `timeText` (board listings only), `comments[]` (up to 20: `commentId`, `content`, `likeCount`, `replyNum`, `createdAtMs`, `createdAtText`, `location`, `client`, `author`, `authorId`, `authorUrl`, `authorAvatarUrl`, `isStarter`), `commentPageCount`, `sourceUrl`, `scrapedAt`.

**error records (`recordType: "error"`)** — invalid URLs, missing/blocked threads, unknown board slugs (never silently dropped).

Every data record carries `sourceUrl`, `scrapedAt` and `recordType`; error records carry `inputValue` in place of `sourceUrl` (the offending input, not a page URL). Null/empty fields are stripped before push.

### Filters

- `minReplyCount`, `minViewCount`, `minLightCount`
- `containsKeyword` (title substring)
- `maxBoardPages` (board pagination depth, 40 threads per page)

### Notes

- Comment pagination beyond page 1 is not served server-side (page 2+ returns empty lists) — the first 20 comments are included; deeper pagination needs login/JS and is documented as out of scope.
- Search (`bbs.hupu.com/search`) renders client-side only; the dedicated search API host does not resolve from datacenter networks — search is documented as out of scope.
- **Board slug refreshes:** Hupu changed its board slug space — `csl`, `all-gambia`, `games`, `military`, `lit`, `film`, `rap` now soft-404 (the site silently serves the homepage). The board enum now contains 28 slugs verified to return real thread rows; unknown slugs are detected via the homepage title and reported as a typed `NOT_FOUND` error record instead of a silent empty run.
- Thread videos (`v.hoopchina.com.cn/*.mp4`) carry expiring signed `auth_key` URLs — the static `videoCover` thumbnail is emitted instead (verified HTTP 200 `image/jpeg` from a clean shell); the signed mp4 is documented as out of scope.
- Author profile URLs (`my.hupu.com/{uid}`) redirect to `passport.hupu.com` login when not authenticated — the URL is correct but profile pages are login-walled; record content (threads/comments) is fully public without login.
- Auto-escalation: on 403/429 the actor lazily engages the Apify AUTO (datacenter) proxy with exponential backoff.
- Memory: 1024 MB (Tier 1, plain HTTP).

# Actor input Schema

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

What to fetch.

## `board` (type: `string`):

Hupu forum board.

## `boardSlug` (type: `string`):

Free-text board slug (e.g. `wnba`) for boards not in the dropdown.

## `maxBoardPages` (type: `integer`):

How many board pages (40 threads each) to walk.

## `threadUrls` (type: `array`):

bbs.hupu.com thread URLs, e.g. `https://bbs.hupu.com/641541442.html`.

## `includeComments` (type: `boolean`):

Attach the first page of comments (up to 20) to thread records.

## `minReplyCount` (type: `integer`):

Drop threads with fewer replies.

## `minViewCount` (type: `integer`):

Drop threads with fewer views (not available on the hot page).

## `minLightCount` (type: `integer`):

Drop threads with fewer likes (亮).

## `containsKeyword` (type: `string`):

Only keep threads whose title contains this substring.

## `maxItems` (type: `integer`):

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "byBoard",
  "board": "nba",
  "maxBoardPages": 3,
  "threadUrls": [],
  "includeComments": true,
  "maxItems": 30
}
```

# Actor output Schema

## `items` (type: `string`):

Dataset containing all scraped Hupu thread records (recordType: thread | error).

# 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 = {
    "mode": "byBoard",
    "board": "nba",
    "maxBoardPages": 3,
    "threadUrls": [],
    "includeComments": true,
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/hupu-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 = {
    "mode": "byBoard",
    "board": "nba",
    "maxBoardPages": 3,
    "threadUrls": [],
    "includeComments": True,
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/hupu-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "byBoard",
  "board": "nba",
  "maxBoardPages": 3,
  "threadUrls": [],
  "includeComments": true,
  "maxItems": 30
}' |
apify call crawlerbros/hupu-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/hupu-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

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