feat(snapshot): refresh API video metadata; keep removed visible

入库 / 小时近新片 / 全量快照成功时以 view_detail 覆盖 title、duration、
pages、cover、bvid、up_*、pubdate 等接口字段,并照旧写七项快照。
原站失效仅标 removed,不删行、不空写元数据;列表与详情继续展示,
快照队列仍跳过 removed。
This commit is contained in:
bot-ci committed 2026-11-03 23:01:15 +08:00
1 parent 99b71c037c
commit 6c73904b25
8 files changed
+329 -34

No files matched your search

+16 -8
View File
@@ -68,13 +68,16 @@ def test_video_listing_filters_and_sorting():
heat = q.list_videos(sort="heat")
aids = [item["aid"] for item in heat["items"]]
assert 104 not in aids, "removed 视频不应进入榜单"
# 热度榜仍按门槛过滤;104 removed 无成功快照,不进热度
assert 104 not in aids
# 综合热度榜应用最小播放门槛 2000:101(1200)与 103(120)被排除
assert aids == [102], aids
assert heat["items"][0]["heat_percentile"] == 100.0
views = q.list_videos(sort="view")
assert [item["aid"] for item in views["items"]] == [102, 101, 103]
# removed(104) 站内继续展示;无指标排在末尾
assert [item["aid"] for item in views["items"]] == [102, 101, 103, 104]
assert views["items"][-1]["status"] == "removed"
interactions = q.list_videos(sort="interaction")
assert interactions["items"][0]["aid"] == 101
@@ -91,14 +94,19 @@ def test_video_listing_filters_and_sorting():
assert [item["aid"] for item in searched["items"]] == [102]
folder = q.list_videos(sort="view", folder_id=3700023351)
assert folder["total"] == 3
assert folder["total"] == 4 # 含 removed 104
folder = q.list_videos(sort="view", folder_id=999)
assert folder["total"] == 0
page = q.list_videos(sort="view", page=2, page_size=1)
assert page["total"] == 3
assert page["pages"] == 3
assert page["total"] == 4
assert page["pages"] == 4
assert [item["aid"] for item in page["items"]] == [101]
detail = q.video_detail(104)
assert detail is not None
assert detail["status"] == "removed"
assert detail["aid"] == 104
finally:
db.close()
@@ -457,7 +465,7 @@ def test_year_filter_and_published_sort():
db, q = setup(tmp)
try:
by_year = q.list_videos(sort="view", year=2026)
assert [item["aid"] for item in by_year["items"]] == [102, 101, 103]
assert [item["aid"] for item in by_year["items"]] == [102, 101, 103, 104]
assert by_year["year"] == 2026
none = q.list_videos(sort="view", year=2025)
@@ -465,10 +473,10 @@ def test_year_filter_and_published_sort():
assert none["total"] == 0
published = q.list_videos(sort="published")
assert [item["aid"] for item in published["items"]] == [103, 101, 102]
assert [item["aid"] for item in published["items"]] == [103, 101, 102, 104]
added = q.list_videos(sort="added")
assert added["total"] == 3
assert added["total"] == 4 # 含 removed
ups = q.list_ups(sort="efficiency", year=2026)
assert ups["year"] == 2026 and ups["total"] == 2