# Weibo Scraper 微博热搜/搜索/正文/评论/博主采集器 — Posts, Trends & Comments (`alias_md5/weibo-scraper`) Actor

微博一站式数据采集器：批量抓取实时热搜榜、关键词搜索微博、长文完整正文与图片视频、热门评论及博主主页资料与博文，自动清理HTML标签，失败条目不收费，导出干净 JSON/CSV/Excel。Scrape Weibo hot search trends, keyword posts, full long-text details, comments & user profiles from $0.75/1k.

- **URL**: https://apify.com/alias_md5/weibo-scraper.md
- **Developed by:** [Alias Data Studio](https://apify.com/alias_md5) (community)
- **Categories:** Social media, News, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 1,000 search post / 关键词搜索微博

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

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Weibo Scraper — Hot Search, Posts & Comments

**微博一站式数据采集器**：批量抓取实时热搜榜、关键词搜索微博、长微博完整正文、图片与视频直链、热门评论及博主主页与博文列表，自动清理 HTML 标签与实体编码，直接导出干净规范的 **JSON / CSV / Excel**。

**All-in-one Weibo data scraper**: extract real-time Hot Search trends (热搜榜), keyword search posts, full un-truncated long-text post details with images and video URLs, top comments, and user profiles + timelines into clean **JSON, CSV, or Excel**.

***

### Why Choose Weibo Scraper / 核心亮点

- **一站式覆盖 / All-in-one**：一个工具覆盖微博实时热搜榜（`hot_search`）、关键词搜微博（`search`）、博主主页与博文（`user_posts`）、微博全文详情（`post_detail`）与热门评论（`comments`）。
- **高性价比、失败不收费 / Cost-effective & Pay Only for Delivered Data**：按实际成功交付的数据条数透明计费，低至 **$0.75 / 1,000 条**——失效链接、已删除微博或无效 UID 自动跳过且绝不扣费，也不会中断整批任务（invalid or deleted targets are skipped cleanly with zero charge）。
- **开箱即用、免复杂配置 / Ready to Use Out of the Box**：直接粘贴完整微博链接（`weibo.com/u/...`、`weibo.com/uid/bid`、`m.weibo.cn/detail/...`）或原始 UID/BID/MID，自动去重解析。
- **干净结构化文本 / Clean Analytics-Ready Output**：自动剥离 `<a>`、`<span class="url-icon">` 等冗余 HTML 标签，自动解码 HTML 实体并保留 `#话题#`、`@用户`、`[表情]`、高清大图链接、视频直链、IP 属地与标准 ISO 时间戳，拿到即可用于舆情分析或喂给 AI。
- **详情附赠热评 / Bonus Preview Comments**：在 `post_detail` 模式下勾选 `shouldIncludeCommentsPreview`，可免费附带最多 5 条热门评论，不另计评论费用。

***

### Common Use Cases / 适用场景

- **品牌舆情与热点追踪 / Brand Monitoring & Trend Intelligence**：定时抓取实时热搜榜与关键词讨论，追踪科技、人工智能、新能源、财经等行业热点发酵节奏。
- **消费者与受众情绪分析 / Audience & Comment Sentiment Analysis**：采集重点微博的完整正文与热门评论，结合 IP 属地、点赞数、转发数与互动比进行舆情研判。
- **KOL 与官方账号监测 / Creator & Official Account Tracking**：批量跟踪科技企业官微、行业领袖与媒体账号的主页粉丝增长、认证信息与最新发布动态。
- **AI Agent 与 RAG 语料构建 / AI Agents & Knowledge Pipelines**：干净无 HTML 残留的结构化 JSON 输出，开箱兼容 Apify MCP Server，可直接接入 Claude、Cursor、ChatGPT 或自研 Agent。

***

### Supported Modes & Honest Depth Matrix / 支持的模式与真实采集深度

| Mode / 模式 | Input Parameters / 输入参数 | Default Public Access / 开箱默认能力 | With Optional Encrypted `cookie` / 选填加密 `cookie` 后 |
| --- | --- | --- | --- |
| `hot_search`（实时热搜榜） | `maxItemsPerQuery`, `shouldIncludePinnedTopics` | 完整获取实时热搜 Top **50+ 条**（排名、热词、`#话题#`、热度值、角标、分类与置顶话题） | 同样完整获取实时榜单 |
| `search`（关键词搜微博） | `keywords`, `searchChannel`（综合/实时/热门）, `maxItemsPerQuery`, `shouldExpandLongText` | 默认返回第 1 页（每词约 **10–15 条**，自动展开长微博全文） | 解锁多页连续翻页，每词最多 **500 条** |
| `user_posts`（博主主页与博文） | `userTargets`（主页链接或 UID）, `shouldIncludeUserProfile`, `maxPostsPerUser`, `shouldExpandLongText` | 完整精确博主主页资料（精确粉丝数、简介、认证、IP属地、注册时间）+ 第 1 页最新博文（约 **10–11 条/博主**） | 完整主页资料 + 深度翻页历史博文，最多 **500 条/博主** |
| `post_detail`（微博全文详情） | `postTargets`（微博链接、BID 或 MID）, `shouldExpandLongText`, `shouldIncludeCommentsPreview` | 完整单条微博元数据、自动展开长文全文、高清图片链接、视频链接、转发原博摘要、IP 属地与可选**免费热门评论预览** | 同样完整获取全文与互动数据 |
| `comments`（微博评论） | `postTargets`, `maxCommentsPerPost`, `commentSort`（热门+最新/热门优先/按最新） | 开箱即支持**多页深度连续翻页**（默认先取热门评论再无缝按时间续抓并自动去重，单条微博可稳定抓取 **100+ 至 1,000 条**评论） | 同样支持深度游标翻页，单条微博最多 **1,000 条** |

> **透明说明 / Transparency Note**：实时热搜榜、微博全文详情以及单条微博多页评论（100+ 条）均开箱即可深度抓取；微博服务端仅对关键词搜索与博主历史时间线的第 2 页起实施登录限制，到达公开上限时本采集器会自动优雅停止并返回全部已成功获取的数据（绝不报错丢数）。如需在搜索或博主历史时间线中翻页抓取更多历史记录，可在输入框中选填加密字段 `cookie`（严格加密，绝不写入日志、错误报告或输出数据集）。

***

### Transparent Pricing / 透明按量计费

按**实际成功交付的数据条数**计费，付费套餐自动享受阶梯折扣；无效目标、删除微博或空结果不产生任何费用：

| Event / 计费项 | Free | Bronze | Silver | Gold / Enterprise |
| --- | ---: | ---: | ---: | ---: |
| **Hot Search / Search Post / User Post（热搜/搜索博文/博主博文，每 1,000 条）** | `$1.50` | `$1.20` | `$0.95` | `$0.75` |
| **Post Detail / User Profile / Comment（微博全文/博主资料/评论，每 1,000 条）** | `$2.00` | `$1.60` | `$1.30` | `$1.00` |

> **附赠说明 / Bonus Note**：在 `post_detail` 模式下开启 `shouldIncludeCommentsPreview` 附带的热门评论完全免费，不会触发独立评论计费。

***

### Example Inputs / 输入示例

#### 1. 实时热搜榜 / Real-Time Hot Search (`mode: "hot_search"`)

```json
{
  "mode": "hot_search",
  "maxItemsPerQuery": 50,
  "shouldIncludePinnedTopics": true
}
```

#### 2. 关键词搜微博 / Keyword Post Search (`mode: "search"`)

```json
{
  "mode": "search",
  "keywords": ["人工智能", "NVIDIA", "新能源汽车"],
  "searchChannel": "comprehensive",
  "maxItemsPerQuery": 30,
  "shouldExpandLongText": true
}
```

#### 3. 博主主页与博文 / User Profile & Timeline (`mode: "user_posts"`)

```json
{
  "mode": "user_posts",
  "userTargets": [
    "https://weibo.com/u/1749127163",
    "1642634100"
  ],
  "shouldIncludeUserProfile": true,
  "maxPostsPerUser": 20,
  "shouldExpandLongText": true
}
```

#### 4. 微博全文详情 + 免费热评预览 / Post Detail (`mode: "post_detail"`)

```json
{
  "mode": "post_detail",
  "postTargets": [
    "https://weibo.com/1749127163/RtaifuS3L"
  ],
  "shouldExpandLongText": true,
  "shouldIncludeCommentsPreview": true
}
```

#### 5. 微博深度评论 / Post Comments (`mode: "comments"`)

```json
{
  "mode": "comments",
  "postTargets": [
    "https://weibo.com/1749127163/RsSMbzSG5"
  ],
  "commentSort": "all",
  "maxCommentsPerPost": 100
}
```

***

### Example Outputs / 输出数据示例

#### 实时热搜记录 / Hot Search Record

```json
{
  "recordType": "hot_search",
  "rank": 1,
  "topicTitle": "AI芯片算力新突破",
  "topicHashtag": "#AI芯片算力新突破#",
  "heatScore": 1100265,
  "badgeLabel": "热",
  "category": "科技",
  "isTopPinned": false,
  "searchUrl": "https://s.weibo.com/weibo?q=%23AI%E8%8A%AF%E7%89%87%E7%AE%97%E5%8A%9B%E6%96%B0%E7%AA%81%E7%A0%B4%23",
  "scrapedAtIso": "2026-11-26T10:30:00.000Z"
}
```

#### 微博博文记录 / Post Record (`search_post`, `user_post`, `post_detail`)

```json
{
  "recordType": "post_detail",
  "postId": "5369510837357649",
  "postBid": "RtaifuS3L",
  "postUrl": "https://weibo.com/1749127163/RtaifuS3L",
  "text": "@大鹏快开车 辛苦了！实测挑战环城高速20圈，综合续航表现超出预期。",
  "textLengthChars": 38,
  "isLongText": true,
  "isFullTextExpanded": true,
  "hashtags": ["新能源汽车"],
  "mentions": ["大鹏快开车"],
  "imageUrls": [
    "https://wx4.sinaimg.cn/large/001Un9Srly1ijfkwx2r2wj61402vhkjl02.jpg"
  ],
  "videoUrl": null,
  "videoDurationSeconds": null,
  "repostCount": 58,
  "commentCount": 128,
  "likeCount": 701,
  "ipLocation": "北京",
  "sourceClient": "Xiaomi 18 Pro",
  "createdAtIso": "2026-11-26T06:30:07.000Z",
  "isRepost": false,
  "repostedPost": null,
  "author": {
    "uid": "1749127163",
    "screenName": "雷军",
    "isVerified": true,
    "verifiedReason": "小米创办人，董事长兼CEO；金山软件董事长；天使投资人。",
    "followerCount": 27334668,
    "profileUrl": "https://weibo.com/u/1749127163"
  }
}
```

#### 微博评论记录 / Comment Record

```json
{
  "recordType": "comment",
  "totalCommentCount": 128,
  "commentId": "5369531716603268",
  "rootCommentId": "5369531716603268",
  "postId": "5369510837357649",
  "postBid": "RtaifuS3L",
  "text": "环线高速实测续航数据很扎实 [酷]",
  "likeCount": 23,
  "replyCount": 7,
  "ipLocation": "北京",
  "createdAtIso": "2026-11-26T07:53:05.000Z",
  "authorUid": "1749127163",
  "authorName": "雷军",
  "isAuthorVerified": true,
  "authorFollowerCount": 27334665,
  "authorProfileUrl": "https://weibo.com/u/1749127163"
}
```

***

### Quick Integration: API, MCP & n8n / 快速集成（API / MCP / n8n）

#### Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("alias_md5/weibo-scraper").call(run_input={
    "mode": "hot_search",
    "maxItemsPerQuery": 50,
    "shouldIncludePinnedTopics": True,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Fetched {len(items)} Weibo hot search items")
```

#### Node.js (`apify-client`)

```javascript
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor("alias_md5/weibo-scraper").call({
  mode: "comments",
  postTargets: ["https://weibo.com/1749127163/RtaifuS3L"],
  commentSort: "all",
  maxCommentsPerPost: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.slice(0, 3));
```

#### AI Agents (Apify MCP Server) / 接入 Claude、Cursor 与 AI Agent

本采集器开箱兼容 **Apify MCP Server**，可在 Claude Desktop、Cursor 或自定义 AI Agent 中直接配置调用，实时追踪微博热搜趋势、检索行业关键词讨论、提取长文正文与热门评论：

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=alias_md5/weibo-scraper",
      "headers": {
        "Authorization": "Bearer <YOUR_APIFY_TOKEN>"
      }
    }
  }
}
```

#### n8n Workflow / n8n 定时热搜与舆情工作流

1. 使用 **Schedule Trigger**（如每天 9:00 或每小时）触发工作流。
2. 添加官方 **Apify** 节点（`@apify/n8n-nodes-apify`）→ **Run Actor**，选择 `alias_md5/weibo-scraper`，输入 `{"mode": "hot_search", "maxItemsPerQuery": 50}`。
3. 衔接 **Get Dataset Items**，将结构化热搜或舆情博文自动推送至飞书、钉钉、Slack、Notion 或大模型摘要节点。

***

### FAQ / 常见问题

- **实时热搜榜与评论开箱能抓多少条？** `hot_search` 开箱可完整获取 Top 50+ 实时热搜条目；`comments` 开箱即支持自动多页深度翻页（默认热门+最新自动去重，单条微博最高支持 1,000 条评论）。
- **如何处理被折叠的长微博和 HTML 标签？** 默认开启 `shouldExpandLongText: true` 自动补全完整正文，并自动剥离冗余 HTML 标签、保留 `#话题#`、`@用户` 与高清图片/视频直链。
- **遇到已删除微博或无效链接会收费吗？** 不会。无效目标、已删除微博或不存在的 UID 均会自动跳过且零费用，并记录在 Key-Value Store 的 `RUN_SUMMARY` 中。
- **关键词搜索与博主历史时间线如何突破第 1 页深度？** 如需在 `search` 或 `user_posts` 模式下深度翻页（最多 500 条），可在输入框中选填加密字段 `cookie`；该字段严格加密，绝不写入日志或输出数据集。

# Actor input Schema

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

Choose what Weibo data to extract / 选择需要采集的微博数据类型。

## `keywords` (type: `array`):

Keywords for Keyword Post Search mode (e.g. '人工智能', 'NVIDIA', '新能源汽车') / 关键词搜微博模式下的搜索词列表。

## `searchChannel` (type: `string`):

Sort channel for keyword search results / 关键词搜索的频道分类。

## `maxItemsPerQuery` (type: `integer`):

Maximum hot search topics (50+ available) or posts per keyword. Without an optional cookie, Weibo returns page 1 (~10–15 posts/keyword); supply an optional cookie to paginate deeper / 热搜榜最多抓取条数（默认可完整获取 50+ 实时热搜）或每个关键词最多抓取博文数（不填 cookie 时微博限流返回第 1 页约 10–15 条/词，填写可选 cookie 可继续翻页）。

## `userTargets` (type: `array`):

Accepts full Weibo profile URLs (https://weibo.com/u/1749127163, https://m.weibo.cn/u/1749127163) or numeric UIDs (1749127163), automatically deduplicated / 支持直接粘贴微博博主主页链接或数字 UID，自动提取并去重。

## `maxPostsPerUser` (type: `integer`):

Maximum timeline posts per user in User Posts mode (set to 0 to extract profile only). Without an optional cookie, Weibo returns page 1 (~10–11 latest posts/user); supply an optional cookie for deeper history / 每位博主最多抓取的微博条数（设为 0 则仅抓取博主主页资料；不填 cookie 时微博返回第 1 页约 10–11 条最新微博，填写可选 cookie 可继续翻页）。

## `shouldIncludeUserProfile` (type: `boolean`):

Emit a structured user_profile record (exact follower count, bio, verification, IP location, registration date) for each user in User Posts mode / 在博主模式下为每位博主输出一条包含精确粉丝数、简介、认证头衔、IP属地与注册时间的主页资料记录。

## `postTargets` (type: `array`):

Accepts full Weibo post URLs (https://weibo.com/1749127163/RtaifuS3L, https://m.weibo.cn/detail/5369510837357649), alphanumeric BIDs (RtaifuS3L), or numeric MIDs, automatically deduplicated / 支持直接粘贴完整微博链接、字母短码 BID 或数字 MID，自动提取并去重。

## `maxCommentsPerPost` (type: `integer`):

Maximum comments per post in Comments mode (supports deep multi-page extraction of 100+ comments per post out of the box, up to 1,000/post) / 单条微博最多抓取评论条数（开箱即支持自动多页深度抓取单条微博 100+ 条乃至最高 1,000 条评论）。

## `commentSort` (type: `string`):

Choose comment ordering: 'all' grabs top hot comments first then seamlessly paginates chronological comments with automatic deduplication; 'latest' paginates chronologically from newest; 'hot' prioritizes top hot comments and continues chronologically when requesting more than 20 comments / 评论抓取策略：'all' 先抓取热门精选再无缝按时间翻页补全并自动去重（推荐）；'latest' 按发布时间从新到旧深度翻页；'hot' 热门优先并在需求超过 20 条时自动按时间续抓。

## `shouldExpandLongText` (type: `boolean`):

Automatically fetch the complete un-truncated text whenever a post is flagged as long text / 当微博被折叠为长文时自动补全完整正文，避免出现“...全文”截断。

## `shouldIncludeCommentsPreview` (type: `boolean`):

Attach up to 5 top comments at no extra cost when scraping Post Details / 抓取微博全文详情时免费附带最多 5 条热门评论，不另计评论费用。

## `shouldIncludePinnedTopics` (type: `boolean`):

Include pinned top topics (rank 0) alongside the numbered real-time Hot Search list / 在实时热搜榜结果中包含顶部置顶话题（排名为 0）。

## `cookie` (type: `string`):

Optional encrypted Cookie string to unlock multi-page pagination in Keyword Search and User Timeline modes. Strictly encrypted and never logged or written to datasets / 可选加密字段，用于解锁关键词搜索与博主历史博文的多页深度翻页；严格加密，绝不写入日志、错误报告或输出数据。

## `requestMinIntervalMs` (type: `integer`):

Minimum wait in milliseconds between consecutive requests / 连续请求之间的最小等待毫秒数。

## `proxyConfiguration` (type: `object`):

Managed connection settings enabled automatically for stable runs / 默认已开启稳定连接配置，一般无需修改。

## Actor input object example

```json
{
  "mode": "hot_search",
  "keywords": [
    "人工智能",
    "NVIDIA"
  ],
  "searchChannel": "comprehensive",
  "maxItemsPerQuery": 50,
  "userTargets": [
    "https://weibo.com/u/1749127163"
  ],
  "maxPostsPerUser": 20,
  "shouldIncludeUserProfile": true,
  "postTargets": [
    "https://weibo.com/1749127163/RtaifuS3L"
  ],
  "maxCommentsPerPost": 100,
  "commentSort": "all",
  "shouldExpandLongText": true,
  "shouldIncludeCommentsPreview": false,
  "shouldIncludePinnedTopics": true,
  "requestMinIntervalMs": 300,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# 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 = {
    "keywords": [
        "人工智能",
        "NVIDIA"
    ],
    "userTargets": [
        "https://weibo.com/u/1749127163"
    ],
    "postTargets": [
        "https://weibo.com/1749127163/RtaifuS3L"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alias_md5/weibo-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 = {
    "keywords": [
        "人工智能",
        "NVIDIA",
    ],
    "userTargets": ["https://weibo.com/u/1749127163"],
    "postTargets": ["https://weibo.com/1749127163/RtaifuS3L"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("alias_md5/weibo-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 '{
  "keywords": [
    "人工智能",
    "NVIDIA"
  ],
  "userTargets": [
    "https://weibo.com/u/1749127163"
  ],
  "postTargets": [
    "https://weibo.com/1749127163/RtaifuS3L"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call alias_md5/weibo-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alias_md5/weibo-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/36uks7VkAFmJQq5W6/builds/AQMNiGKnoN8lcEC99/openapi.json
