Skip to content

feat(trending): 接入小红书热榜 - #219

Merged
fxbin merged 1 commit into
mainfrom
issue-215-xiaohongshu-trending
Nov 3, 2026
Merged

fxbin merged 1 commit into
mainfrom
issue-215-xiaohongshu-trending

Conversation

@fxbin

@fxbin fxbin commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Closes #215

改了什么

  • 后端:trending_scrapers 新增 xiaohongshu 信源(_xiaohongshu.py),经 60s 聚合 API(/v2/rednote)取小红书实时热点。小红书 App 接口反爬严、直连需伪造设备指纹(属绕反爬,不做),评估结论见 issue。
  • 配置:新增 API60S_BASE_URL(默认官方实例 https://60s-api.viki.moe,.env 可换自部署实例),与 RSSHub 实例同一思路。
  • 降级:上游渠道故障(HTTP 5xx / code!=200 / 空数据 / 网络错)时返回空列表,pipeline 对空结果不删旧数据、不影响其他信源同步。
  • 前端:热榜页 SOURCE_BRAND 补「小红书」品牌标签;测试补已知/未知信源标签断言。

已知事实

接入时点 60s 官方实例的 /v2/rednote 返回 HTTP 500(其上游小红书接口未吐数据,60s 服务端问题;文档主打端点,历史上可用)。通道恢复后本端零改动即生效。测试全部 mock,不真发请求;上线后用 POST /trending/sync/xiaohongshu 手动单刷可验证真实通道。

Verification(本地,隔离 worktree /tmp/topiceye-xhs)

检查 结果
py_compile(改动 py 文件) ✅
ruff check + format(改动文件) ✅
注册冒烟(get_trending_cls / TrendingSource / syncable 列表) ✅
make layering ✅ 108 文件无违规
后端全量 pytest(一次性 PG:16,自持容器名) ✅ 1786 passed,exit 0,[100%]
前端 vitest _trending-utils.test.ts ✅ 6/6
tsc --noEmit ✅

覆盖:正常解析(rank/score 万单位/cover/extra)、base_url 拼接与尾斜杠清理、HTTP 500、HTTP 200 但 code=500、空数据、网络错、非 JSON 体、空标题跳过、rank 缺省回退位次。

注:并行会话的 test_full_local.sh 端口约定(5544/5554)今晚互相干扰,本 PR 的全量改用自持容器(topiceye-xhs-pg,端口 5620)跑,命令与脚本等价。

新增 xiaohongshu 信源,经 60s 聚合接口取小红书实时热点(App 接口反爬严,不自爬)。实例地址可用 API60S_BASE_URL 换成自部署;上游渠道故障时本轮抓取跳过、保留旧数据,不影响其他信源。热榜页补小红书品牌标签。

(#215)
@fxbin
fxbin merged commit e0cd070 into main Nov 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

接入小红书热榜(60s 聚合 API 通道)

1 participant