# 微博多榜数据结构参考 ## 一、热门搜索 API 数据结构 ### 1.1 热搜榜返回字段 | 字段 | 类型 | 说明 | 示例 | |------|------|------|------| | word | string | 热搜关键词/标题 | "特朗普宣布关税政策" | | word_scheme | string | 热搜跳转路径 | "/hot/7890123" | | num | number | 热度值 | 1234567 | | raw_hot | number | 原始热度值 | 1234567 | | rank | number | 排名 | 1 | | note | string | 热搜摘要 | "特朗普宣布对多国加征关税" | | flag | number | 数据有效性 (1=有效) | 1 | | label_name | string | 标签 ("新"/"沸"/"爆") | "新" | | category | string | 分类 (可选) | "社会" | | icon | string | 图标 (可选) | "" | ### 1.2 字段说明 - **word**: 热搜话题标题,用于展示和搜索 - **word_scheme**: 跳转路径,可拼接为 `https://weibo.com{word_scheme}` - **num**: 计算后的热度值,可能经过标准化 - **raw_hot**: 原始热度,未经处理的数值 - **rank**: 当前排名,1-50 - **note**: 热搜的简要描述,通常是词条的相关信息 - **flag**: 数据有效性标志,1/2 表示有效,0 可能表示广告或无效 - **label_name**: 标签,新、沸、爆 等 ## 二、搜索详情 API 数据结构 ### 2.1 搜索结果返回字段 | 字段 | 类型 | 说明 | |------|------|------| | mid | string | 微博 ID | | text | string | 微博正文 (HTML 格式) | | pic_ids | string[] | 图片 ID 列表 | | user.id | number | 用户 ID | | user.screen_name | string | 用户昵称 | | user.followers_count | number | 粉丝数 | | user.verified | boolean | 是否认证 | | reposts_count | number | 转发数 | | comments_count | number | 评论数 | | attitudes_count | number | 点赞数 | | created_at | string | 发布时间 | ### 2.2 图片 ID 转换为 URL ```python # pic_id 到完整 URL 的转换 pic_id = "CgyXxxx" # 尺寸选项: thumb, bmiddle, large, mw690 image_url = f"https://wx1.sinaimg.cn/large/{pic_id}.jpg" ``` ## 三、合并数据结构设计 ### 3.1 每日汇总 JSON ```json { "date": "2026-03-29", "timestamp": "2026-03-29T10:30:00Z", "boards": { "hot": { "name": "热搜榜", "type": "hot", "url": "https://m.weibo.cn/api/index/list?type=hot", "count": 50, "items": [ { "rank": 1, "word": "特朗普宣布关税政策", "word_scheme": "/hot/7890123", "url": "https://s.weibo.com/weibo?q=特朗普宣布关税政策", "detail_url": "https://m.weibo.cn/detail/5281181642153648", "hot_value": 1234567, "note": "特朗普宣布对多国加征关税", "label": "新", "flag": 1 } ] }, "entertainment": { "name": "文娱榜", "type": "entertainment", "url": "https://m.weibo.cn/api/index/list?type=entertainment", "count": 50, "items": [...] } }, "metadata": { "version": "1.0", "source": "weibo_scraper", "total_items": 250, "boards_count": 5 } } ``` ### 3.2 单条热搜数据结构 ```json { "rank": 1, "word": "热搜关键词", "word_scheme": "/hot/123456", "url": "https://s.weibo.com/weibo?q=热搜关键词", "detail_url": "https://m.weibo.cn/detail/5281181642153648", "hot_value": 1234567, "note": "热搜摘要", "label": "新", "flag": 1, "category": "社会" } ``` ### 3.3 详情页数据结构 (可选扩展) ```json { "mid": "5281181642153648", "content": { "text": "微博正文内容", "text_html": "
微博正文内容
", "images": [ { "pic_id": "CgyXxxx", "url": "https://wx1.sinaimg.cn/large/CgyXxxx.jpg" } ] }, "author": { "id": 123456, "screen_name": "用户名", "followers_count": 10000, "verified": true, "verified_type": 0 }, "engagement": { "reposts_count": 100, "comments_count": 200, "attitudes_count": 500 }, "timestamp": "2026-03-29T10:00:00Z" } ``` ## 四、数据类型定义 ### 4.1 TypeScript 接口 ```typescript interface WeiboHotItem { rank: number; word: string; word_scheme: string; url: string; detail_url: string; hot_value: number; note: string; label: string; flag: number; category?: string; } interface WeiboBoard { name: string; type: string; url: string; count: number; items: WeiboHotItem[]; } interface WeiboDailyReport { date: string; timestamp: string; boards: { [key: string]: WeiboBoard; }; metadata: { version: string; source: string; total_items: number; boards_count: number; }; } ``` ## 五、字段映射表 ### 5.1 API 字段到输出字段 | API 原始字段 | 输出字段 | 说明 | |-------------|---------|------| | word | word | 热搜关键词 | | word_scheme | word_scheme | 跳转路径 | | num | - | 内部使用 | | raw_hot | hot_value | 热度值 | | rank | rank | 排名 | | note | note | 摘要 | | label_name | label | 标签 | | flag | flag | 有效性 | | - | url | PC 端搜索 URL | | - | detail_url | 移动端详情 URL | --- *生成时间: 2026-03-29*