微博热搜多榜爬取参考资源 (Toplist)
一、多榜 API 接口
1. 分类榜单端点
| 榜单 |
端点 |
type 参数 |
认证 |
状态 |
| 我的热搜 |
https://m.weibo.cn/api/index/list?type=mine |
mine |
无需 |
待验证 |
| 热搜榜 |
https://m.weibo.cn/api/index/list?type=hot |
hot |
无需 |
✅ 已验证 |
| 文娱榜 |
https://m.weibo.cn/api/index/list?type=entertainment |
entertainment |
无需 |
待验证 |
| 生活榜 |
https://m.weibo.cn/api/index/list?type=life |
life |
无需 |
待验证 |
| 社会榜 |
https://m.weibo.cn/api/index/list?type=social |
social |
无需 |
待验证 |
2. 详情获取 API
| 端点 |
用途 |
认证 |
https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D1%26q={keyword} |
关键词搜索,返回详情 |
无需 |
https://m.weibo.cn/detail/{mid} |
移动端详情页 |
无需 |
3. 备用 API
| 端点 |
用途 |
认证 |
https://weibo.com/ajax/side/hotSearch |
PC 端热搜榜 |
建议 Cookie |
https://weibo.com/ajax/statuses/mymblog |
用户微博列表 |
需要 Cookie |
二、数据结构
2.1 热搜列表返回
{
"ok": 1,
"data": {
"realtime": [
{
"word": "热搜关键词",
"word_scheme": "/hot/12345",
"num": 1234567,
"raw_hot": 1234567,
"rank": 1,
"note": "摘要内容",
"flag": 1,
"label_name": "新"
}
]
}
}
2.2 搜索详情返回
{
"ok": 1,
"data": {
"cards": [
{
"mblog": {
"mid": "5281181642153648",
"text": "微博正文内容 (HTML)",
"pic_ids": ["CgyXxxx", "Dhzyyyy"],
"user": {
"id": 123456,
"screen_name": "用户名",
"followers_count": 10000,
"verified": true
},
"reposts_count": 100,
"comments_count": 200,
"attitudes_count": 500
}
}
]
}
}
2.3 合并数据结构
{
"date": "2026-03-29",
"timestamp": "2026-03-29T10:30:00Z",
"boards": {
"hot": {
"name": "热搜榜",
"url": "https://m.weibo.cn/api/index/list?type=hot",
"count": 50,
"items": [...]
},
"entertainment": {
"name": "文娱榜",
"url": "https://m.weibo.cn/api/index/list?type=entertainment",
"count": 50,
"items": [...]
},
"life": {...},
"social": {...},
"mine": {...}
},
"metadata": {
"version": "1.0",
"source": "weibo_scraper",
"total_items": 250
}
}
三、存储方案
3.1 文件命名规范
| 类型 |
格式 |
示例 |
| 每日汇总 |
weibo_YYYYMMDD.json |
weibo_20260329.json |
| 单榜数据 |
weibo_YYYYMMDD_{board}.json |
weibo_20260329_hot.json |
| 详情目录 |
weibo_YYYYMMDD_detail/ |
weibo_20260329_detail/ |
| HTML 报告 |
weibo_YYYYMMDD.html |
weibo_20260329.html |
3.2 目录结构
output/
├── 2026-03-29/
│ ├── weibo_20260329.json # 每日汇总
│ ├── weibo_20260329.html # HTML 报告
│ ├── weibo_20260329_hot.json # 热搜榜数据
│ ├── weibo_20260329_entertainment.json
│ ├── weibo_20260329_life.json
│ ├── weibo_20260329_social.json
│ └── detail/ # 详情页数据
│ ├── item_001.json
│ └── item_002.json
└── archive/
└── 2026-03/
四、图片处理
4.1 CDN 域名
| 域名 |
用途 |
wx1.sinaimg.cn |
主 CDN |
ws1.sinaimg.cn |
备用 CDN |
4.2 尺寸参数
| 参数 |
尺寸 |
thumb |
缩略图 |
bmiddle |
中图 |
large |
大图 |
mw690 |
690px 宽度 |
4.3 完整 URL
https://wx1.sinaimg.cn/large/{pic_id}.jpg
五、输出格式
5.1 JSON 输出
{
"date": "2026-03-29",
"boards": [
{
"name": "热搜榜",
"type": "hot",
"items": [
{
"rank": 1,
"word": "关键词",
"url": "https://m.weibo.cn/detail/5281181642153648",
"hot_value": 1234567,
"note": "摘要"
}
]
}
]
}
5.2 HTML 输出
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>微博热搜日报 2026-03-29</title>
</head>
<body>
<h1>微博热搜日报 2026-03-29</h1>
<div class="board">
<h2>热搜榜</h2>
<div class="item">
<span class="rank">1</span>
<a class="title" href="...">关键词</a>
<span class="hot">1234万</span>
</div>
</div>
</body>
</html>
六、开源参考
6.1 爬虫项目
6.2 相关资源
七、数据流程
┌─────────────────────────────────────────────┐
│ 多榜爬取 (for each board_type) │
│ m.weibo.cn/api/index/list?type={board} │
└──────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 提取 word, num, raw_hot, rank, note │
└──────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 详情页获取 (可选) │
│ m.weibo.cn/api/container/getIndex │
└──────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 数据合并 (按日期聚合) │
└──────────────┬──────────────────────────────┘
│
▼
┌──────┴──────┐
▼ ▼
JSON 文件 HTML 报告
八、独立信源列表
- https://github.com/nghuyong/WeiboSpider - WeiboSpider 分布式爬虫
- https://github.com/dataabc/weibo-crawler - 简洁微博爬虫
- https://m.weibo.cn/api/index/list?type=hot - 热搜榜 API
- https://m.weibo.cn/api/container/getIndex - 搜索 API
- https://m.weibo.cn/detail/{mid} - 详情页 API
- https://open.weibo.com/ - 微博开放平台
- https://github.com/lyfeyaj/weibo-py2 - Python SDK
- https://github.com/liujun3660105/node-weibo-api - Node.js SDK
验收检查
- [x] toplist.md 列出所有待爬取的榜单及 API
- [x] 数据结构参考完整
- [x] 存储方案明确
- [ ] crawl/ 包含至少 3 个榜单的 API 调用示例
更新时间: 2026-03-29