# 全平台热搜 API Documentation

> 一次获取微博热搜、知乎热榜、B站日榜和百度贴吧热议。可按平台筛选、限制条数。成功获取扣 2 算力，失败不扣费。

## Overview

This document describes how to call the **全平台热搜** API.

- **Model / path slug**: `content/hot-search`
- **Task type**: `sync` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/62`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `POST https://xiaoapis.com/api/content/hot-search`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `POST`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `platform` | Yes | all 或 weibo,zhihu,bilibili,tieba，默认 all |
| `limit` | Yes | 每个平台条数，1 到 50，默认 10 |
| `timeout` | Yes | 超时秒数，5 到 60，默认 15 |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
POST https://xiaoapis.com/api/content/hot-search
```

## Details

## 接口说明：

同步聚合**微博热搜、知乎热榜、B站日榜、百度贴吧热议**。不传 platform 时一次返回四个平台。也可以只查一个平台，或用英文逗号组合，例如 `weibo,zhihu`。至少返回一条热搜才扣费，全部失败不扣费。

热搜标题和链接来自各平台公开榜单，仅供选题、监测和内容策划。转载或商用具体内容须遵守对应平台规则。

**计费：**每次成功获取扣 `2` 算力；参数错误或没有数据不扣费。

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json 或 application/x-www-form-urlencoded |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| key | 是 | string | 你的密钥 | 平台 API 密钥 |
| platform | 否 | string | all | all、weibo、zhihu、bilibili、tieba。多个用英文逗号。也接受微博、知乎、B站、贴吧。默认 all |
| limit | 否 | int | 10 | 每个平台返回条数，1 到 50。默认 10 |
| timeout | 否 | int | 15 | 超时秒数，5 到 60。默认 15 |

只接受 POST。表单或 JSON 均可，参数放在请求体里。不传参数时返回四个平台各 10 条。

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 状态码，200 表示成功 |
| msg | string | 状态信息 |
| data.generated_at | string | 数据生成时间 |
| data.platform | string | 本次请求的平台参数 |
| data.requested_platforms | array | 实际请求的平台标识 |
| data.limit_per_platform | int | 每个平台条数上限 |
| data.total_items | int | 全部平台条目合计 |
| data.failed_platforms | array 或 object | 失败平台及原因。全部成功时为空数组 |
| data.platforms | object | 按 weibo、zhihu、bilibili、tieba 分组 |
| data.platforms.*.name | string | 榜单名称 |
| data.platforms.*.homepage | string | 榜单页面 |
| data.platforms.*.status | string | 该平台抓取状态 |
| data.platforms.*.count | int | 本平台返回条数 |
| data.platforms.*.items | array | 热搜条目。常见字段 rank、title、hot、url；微博另有 label、mobile_url；知乎另有 excerpt、answer_count、follower_count；B站另有 author、duration、danmaku、cover；贴吧另有 excerpt。摘要最长 800 字 |

## Response Example

```json
{
    "code": 200,
    "msg": "获取成功",
    "data": {
        "generated_at": "2026-07-31T05:13:59+08:00",
        "platform": "all",
        "requested_platforms": [
            "weibo",
            "zhihu",
            "bilibili",
            "tieba"
        ],
        "limit_per_platform": 1,
        "total_items": 4,
        "failed_platforms": [],
        "platforms": {
            "weibo": {
                "name": "微博热搜",
                "homepage": "https://s.weibo.com/top/summary?cate=realtimehot",
                "status": "success",
                "count": 1,
                "items": [
                    {
                        "rank": 1,
                        "title": "示例话题",
                        "hot": 100000,
                        "label": "热",
                        "url": "https://s.weibo.com/weibo?q=示例",
                        "mobile_url": "https://m.weibo.cn/search?q=示例"
                    }
                ]
            },
            "zhihu": {
                "name": "知乎热榜",
                "homepage": "https://www.zhihu.com/billboard",
                "status": "success",
                "count": 1,
                "items": [
                    {
                        "rank": 1,
                        "title": "示例问题",
                        "hot": "100 万热度",
                        "excerpt": "示例摘要",
                        "answer_count": 10,
                        "follower_count": 20,
                        "url": "https://www.zhihu.com/question/1"
                    }
                ]
            },
            "bilibili": {
                "name": "B站日榜",
                "homepage": "https://www.bilibili.com/v/popular/rank/all",
                "status": "success",
                "count": 1,
                "items": [
                    {
                        "rank": 1,
                        "title": "示例视频",
                        "hot": 1000,
                        "author": "示例作者",
                        "duration": "03:20",
                        "danmaku": 10,
                        "cover": "https://你的域名/cover.jpg",
                        "url": "https://www.bilibili.com/video/BV示例"
                    }
                ]
            },
            "tieba": {
                "name": "百度贴吧热议",
                "homepage": "https://tieba.baidu.com/hottopic/browse/topicList",
                "status": "success",
                "count": 1,
                "items": [
                    {
                        "rank": 1,
                        "title": "示例热议",
                        "hot": "10W实时讨论",
                        "excerpt": "示例摘要",
                        "url": "https://tieba.baidu.com/hottopic/browse/hottopic?topic_id=1"
                    }
                ]
            }
        }
    }
}
```

## Error Codes

| 业务码 | 说明 |
| --- | --- |
| 200 | 获取成功 |
| 400 | 参数错误。此类错误不扣费 |
| 403 | 认证失败，请检查 key |
| 500 | 热搜暂时无法获取，或四个平台都没有数据。此类错误不扣费 |

## Usage Flow

1. Obtain your API Key from the console
2. Call the endpoint with `key` and required parameters
3. Parse the JSON (or binary) response according to the examples above

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
