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:
1 parent
99b71c037c
commit
6c73904b25
8 files changed
+329
-34
No files matched your search
@@ -256,11 +256,41 @@ def view_for(
|
||||
reply: int = 16,
|
||||
danmaku: int = 7,
|
||||
bvid: str | None = None,
|
||||
title: str | None = None,
|
||||
duration: int | None = None,
|
||||
pages: int | None = None,
|
||||
cover: str | None = None,
|
||||
up_mid: int | None = None,
|
||||
up_name: str | None = None,
|
||||
up_face: str | None = None,
|
||||
pubdate: int | None = None,
|
||||
) -> dict[str, Any]:
|
||||
item = copy.deepcopy(VIEW_PAYLOAD)
|
||||
data = item["data"]
|
||||
data["aid"] = aid
|
||||
data["bvid"] = bvid or f"BV{aid}"
|
||||
if title is not None:
|
||||
data["title"] = title
|
||||
if duration is not None:
|
||||
data["duration"] = duration
|
||||
if cover is not None:
|
||||
data["pic"] = cover
|
||||
if pubdate is not None:
|
||||
data["pubdate"] = pubdate
|
||||
data["ctime"] = pubdate
|
||||
if pages is not None:
|
||||
data["videos"] = pages
|
||||
data["pages"] = [
|
||||
{"cid": 1000 + i, "page": i + 1, "from": "vupload", "part": f"P{i + 1}"}
|
||||
for i in range(max(1, int(pages)))
|
||||
]
|
||||
owner = data.setdefault("owner", {})
|
||||
if up_mid is not None:
|
||||
owner["mid"] = up_mid
|
||||
if up_name is not None:
|
||||
owner["name"] = up_name
|
||||
if up_face is not None:
|
||||
owner["face"] = up_face
|
||||
data["stat"].update({
|
||||
"aid": aid,
|
||||
"view": view,
|
||||
|
||||
Reference in new issue
Block a user