feat(monitor): 粘贴视频链接换出博主主页
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

运营手上常常只有一条作品的分享链接,可监控任务认的是主页里的 sec_uid。

- 从整段分享文案里抠链接(链接前后都是字,按行切切不开),短链先展开,
  再从中取作品 id,最后用详情接口换 author.sec_uid
- 一次最多 20 条,串行 + 0.4 秒间隔;单条失败只在那一条上报错,不连累整批
- normalize_aweme 补上 creator_id:哈希拼不出主页地址,顺带让以后入库的
  抖音作品也带主页链接
- 监控页左上角「视频转主页」,支持逐条复制和一键复制全部(http 下没有
  navigator.clipboard,走 execCommand 兜底)
This commit is contained in:
2026-10-23 08:55:26 +08:00
parent 8e398a5ba1
commit 1474e5e3eb
12 changed files with 651 additions and 6 deletions
+19
View File
@@ -39,6 +39,7 @@ from ..monitor import (
service,
tagrules,
upstream,
video_link,
)
from ..monitor import identities as identity_pool
from ..monitor.db import get_session
@@ -69,6 +70,7 @@ from ..schemas.monitor import (
TagPayload,
MonitorTaskCreate,
MonitorTaskUpdate,
VideoLinksPayload,
WebhookPayload,
WebhookTestPayload,
)
@@ -942,6 +944,23 @@ async def send_daily_digest_now(platform: str = Query(default=PLATFORM_XHS)):
return {"ok": True, "rows": count, "detail": detail}
# ---------------------------------------------------------------------------
# 视频链接 → 博主主页
# ---------------------------------------------------------------------------
#
# 纯查询,不写库:拿到主页地址之后要不要建监控任务,由人决定。
@router.post("/video-links")
async def resolve_video_links(payload: VideoLinksPayload):
"""把粘贴进来的视频链接/分享文案换成博主主页地址。
一次最多 20 条,逐条串行请求详情接口。单条失败只在那一条上写 ``error``,
其余照常返回 —— 批量粘贴时最不需要的就是「一条挂全批挂」。
"""
return await video_link.resolve(payload.text)
# ---------------------------------------------------------------------------
# 身份池
# ---------------------------------------------------------------------------