trending
POST /v1/trending 是“热榜”动作:现在什么在火。目前在 8 个平台上开放(X、Reddit、小红书、抖音、微博、B 站 等),平台是请求里的一个参数。每次调用 2 到 12 积分,因平台而异;失败的调用不扣。
POST
https://api.socialtoai.com/v1/trending请求
请求体是 JSON。下面这几项每个动作都一样,其余的参数因平台而异,见后文。
| 名称 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
platform | string | 请求体 | 是 | 要读的平台,取这个动作已开放的平台之一。 |
max_cost_credits | integer | 请求体 | 否 | 这次调用最多花多少积分。超出时免费拒绝,并在返回里给出报价。 |
Idempotency-Key | string | 请求头 | 否 | 1 到 255 个可见 ASCII 字符。同一个键加同样的参数会返回第一次的结果,不会重复扣费。 |
平台与积分
每个平台收的参数不同。平台自己的页面上有完整的参数表、字段表和可以改的请求。
| 平台 | 价格键 | 积分 | 必填 | 可选 | 每页 |
|---|---|---|---|---|---|
| X | x.trending | 6 | – | board、region | 30 |
reddit.trending | 2 | – | board | 25 | |
| 小红书 | xiaohongshu.trending | 12 | – | board | 20 |
| 抖音 | douyin.trending | 2 | – | board | 51 |
| 微博 | weibo.trending | 2 | – | board | 51 |
| B 站 | bilibili.trending | 2 | – | board | 50 |
| 知乎 | zhihu.trending | 2 | – | board | 50 |
| 快手 | kuaishou.trending | 2 | – | – | 60 |
有些平台的这个动作还有另一种取值,由某个参数选中,单独计价:
| 平台 | 价格键 | 积分 | 由什么选中 |
|---|---|---|---|
reddit.trending:trends | 2 | type=trends | |
| 抖音 | douyin.trending:videos | 2 | type=videos |
| B 站 | bilibili.trending:videos | 2 | type=videos |
参数
| 名称 | 类型 | 说明 | 哪些平台收 |
|---|---|---|---|
board | string | 选哪个榜:现在只有趋势榜取值因平台而异:trends、popular、searches、inspiration、hot_search、rising、topics、music … | X、Reddit、小红书、抖音、微博、B 站和知乎 |
region | string | 取哪个国家的趋势,两个字母的代码:US、GB、CA、AU、IN、JP、DE、FR、BR、MX;不写是全球 | X |
示例
X:现在的热榜:标题、名次和热度。
curl https://api.socialtoai.com/v1/trending \ -H "Authorization: Bearer $SOCIALTOAI_KEY" \ -H "Content-Type: application/json" \ -d '{ "platform": "x" }'import osimport requestsresponse = requests.post( "https://api.socialtoai.com/v1/trending", headers={"Authorization": f"Bearer {os.environ['SOCIALTOAI_KEY']}"}, json={ "platform": "x", },)print(response.json()){ "request_id": "req_00000000-0000-4000-8000-000000000001", "schema_version": "v1", "fetched_at": "2026-10-13T03:29:53.000Z", "action": "trending", "platform": "x", "status": "ok", "items": [ { "platform": "x", "id": null, "ref": null, "approx": [], "type": "entry", "entry_type": "trend", "title": "…", "url": null, "rank": 1, "heat": null, "fields": {} } ], "unavailable": ["id", "heat", "url"], "page": { "has_more": false }, "warnings": [], "applied_params": {}, "cost_credits": 6, "billing": { "cost_credits": 6, "balance_credits": 94, "today_spend_credits": 6, "daily_limit_credits": null, "daily_remaining_credits": null, "display": "本次 6 积分,余额 94 积分" }, "replayed": false}示例数据:名字、链接和正文已换成占位符。
返回什么
返回外层结构,items 里是 entry:trend、content 对象。一次调用返回一页,最多 30 条;每一页是一次调用。cursor 最长 30 分钟内有效。
失败的调用是 0 积分,并说明原因,见错误。
最近更新: