# 微博API接口技术手册 ## 概述 本文档整理微博平台可用API接口的详细信息,包括端点、参数和返回格式。 --- ## 1. 移动端热搜API ### 端点 ``` https://m.weibo.cn/api/index/list?type=hot ``` ### 请求头 ``` User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 Accept: application/json ``` ### 返回格式 ```json { "ok": 1, "data": [ { "hot_id": "1", "word": "热搜词", "raw_hot": 2478423, "label_name": "标签", "url": "搜索链接" } ] } ``` ### 特点 - ✅ 无需登录 - ✅ 返回JSON - ✅ 反爬较弱 - ❌ 数据量有限 --- ## 2. PC端热搜API ### 端点 ``` https://weibo.com/ajax/side/hotSearch ``` ### 请求头 ``` User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Cookie: SUB=_2A25KKkRhDeRhGeNN... Referer: https://weibo.com ``` ### 返回格式 ```json { "ok": 1, "data": { "realtime": [ { "word": "热搜词", "raw_hot": 2478423, "note": "热度排名", "label_name": "标签" } ] } } ``` ### 特点 - ✅ 数据全面 - ✅ 实时性高 - ❌ 需要Cookie - ❌ 反爬较强 --- ## 3. 用户微博API ### 端点 ``` https://weibo.com/ajax/statuses/mymblog?uid={uid}&page=1 ``` ### 参数 | 参数 | 说明 | |------|------| | uid | 用户ID | | page | 页码 | | feature | 过滤类型 | ### 返回格式 ```json { "ok": 1, "data": { "list": [ { "id": "123456", "text": "微博内容", "created_at": "Thu Mar 27 15:30:00 +0800 2026", "reposts_count": 10, "comments_count": 20, "attitudes_count": 100 } ] } } ``` ### 特点 - ✅ 可获取指定用户微博 - ❌ 需要登录 - ❌ 频率限制 --- ## 4. 话题搜索API ### 端点 ``` https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D1%26q%3D{keyword} ``` ### 参数 | 参数 | 说明 | |------|------| | containerid | 搜索容器ID | | q | 关键词 | | page | 页码 | --- ## 5. 评论API ### 端点 ``` https://m.weibo.cn/comments/hotflow?id={weibo_id}&mid={weibo_id}&max_id={max_id} ``` ### 参数 | 参数 | 说明 | |------|------| | id | 微博ID | | mid | 微博MID | | max_id | 分页ID | --- ## API对比 | API | 登录要求 | 数据量 | 稳定性 | 推荐指数 | |-----|----------|--------|--------|----------| | 移动端热搜 | ✗ | 中 | 高 | ⭐⭐⭐⭐⭐ | | PC端热搜 | ✓ | 全 | 中 | ⭐⭐⭐⭐ | | 用户微博 | ✓ | 中 | 中 | ⭐⭐⭐ | | 话题搜索 | ✗ | 中 | 中 | ⭐⭐⭐⭐ | | 评论 | ✓ | 多 | 低 | ⭐⭐⭐ | --- ## 使用建议 1. **热搜数据**: 移动端API为主,PC端为备 2. **用户微博**: 使用Cookie池轮换 3. **评论采集**: 注意频率限制 4. **容错方案**: API失败时降级到页面解析 --- *文档生成时间:2026-03-28*