Files
YMhut-box-C-/新增工具文档/今日热榜 - 聚合接口.md
T
QWQLwToo f59190251d
build-winui / winui (push) Has been cancelled
Add project metadata and docs
2026-06-26 13:26:40 +08:00

179 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
\### 接口概览
本接口用于获取各大平台今日热榜的排行数据。不传入任何参数时,将返回支持的平台列表(如 36氪、哔哩哔哩、知乎等)。传入指定平台标题后,可获取该平台的热点排行详情。
\### 请求地址
`https://api.pearapi.ai/api/dailyhot/`
\### 请求方式
GET
\### 返回格式
JSON
\### 权限/付费要求
免费接口,无需付费或特殊权限。
\### 请求参数说明
| 参数名 | 是否必填 | 用途 |
| :--- | :--- | :--- |
| `title` | 是 | 平台标题,用于指定要获取热榜的平台,例如“哔哩哔哩”。不传入此参数时,接口返回所有支持的平台列表。 |
\### 默认请求示例
```json
{
  "title": "哔哩哔哩"
}
```
对应的实际请求 URL 示例为:
`https://api.pearapi.ai/api/dailyhot/?title=哔哩哔哩`
\### 返回字段说明
| 字段路径 | 类型 | 描述 |
| :--- | :--- | :--- |
| `code` | integer | 状态码,表示请求结果 |
| `name` | string | 平台名称,如“哔哩哔哩” |
| `title` | string | 热点标题 |
| `type` | string | 榜单名称,如“热门视频” |
| `description` | string | 平台描述 |
| `link` | string | 来源目标链接 |
| `total` | integer | 获取到的热点数量 |
| `updateTime` | string | 数据更新时间 |
| `formCache` | string | 是否从缓存中获取(“是”或“否”) |
| `data` | string | 返回的热点数据列表,内部包含多个热点对象 |
| `data\[].id` | integer | 热点ID |
| `data\[].desc` | string | 热点描述 |
| `data\[].cover` | string | 热点封面图片链接 |
| `data\[].hot` | string | 热点热度数值 |
| `data\[].timestamp` | string | 热点时间戳 |
| `data\[].url` | string | 热点链接 |
| `data\[].mobileUrl` | string | 热点手机端链接 |
\### 返回示例
由于原配置中未提供示例结果,以下为根据字段结构构造的典型返回示例:
```json
{
  "code": 200,
  "name": "哔哩哔哩",
  "title": "哔哩哔哩热门视频",
  "type": "热门视频",
  "description": "哔哩哔哩弹幕视频网热门内容",
  "link": "https://www.bilibili.com/",
  "total": 50,
  "updateTime": "2025-04-10 12:00:00",
  "formCache": "否",
  "data": \[
  {
  "id": 1,
  "desc": "这是一个热门视频的简介",
  "cover": "https://example.com/cover.jpg",
  "hot": "123456",
  "timestamp": "2025-04-10 11:30:00",
  "url": "https://www.bilibili.com/video/example",
  "mobileUrl": "https://m.bilibili.com/video/example"
  }
  ]
}
```
\### 对接注意事项
1\. \*\*参数传递\*\*`title` 参数必须通过 URL 查询字符串传递,如 `?title=哔哩哔哩`
2\. \*\*平台名称\*\*`title` 的值需与接口返回的平台列表中的名称完全一致,包括大小写和标点符号。
3\. \*\*返回结构\*\*:当不传入 `title` 时,返回的数据结构可能与传入 `title` 时不同,建议先测试无参数请求以获取平台列表。
4\. \*\*数据时效性\*\*`updateTime``formCache` 字段可判断数据是否为最新,建议根据业务需求决定是否信任缓存数据。
\### 给 AI 助手的实现建议
1\. \*\*请求构建\*\*:使用 HTTP GET 方法,将 `title` 参数附加到 URL 后。如果用户未提供 `title`,则直接请求基础 URL。
2\. \*\*错误处理\*\*:检查返回的 `code` 字段,非 200 时视为请求失败,需提示用户或重试。
3\. \*\*数据解析\*\*`data` 字段是一个数组,需遍历处理每个热点对象,提取 `id``desc``cover``hot``timestamp``url``mobileUrl` 等字段。
4\. \*\*平台列表获取\*\*:若用户未指定平台,可先调用无参数接口获取平台列表,再引导用户选择。
5\. \*\*编码问题\*\*:URL 中的中文字符(如“哔哩哔哩”)需进行 URL 编码,确保请求正确。