fix(sites): 憨憨详情页按真实结构解析豆瓣块与 MediaInfo
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
df22200bfd
commit
653bdcb976
6 files changed
+71
-6
No files matched your search
@@ -1,4 +1,9 @@
|
||||
import { HHANCLUB_DETAIL_PAGE_2026, HHANCLUB_DETAIL_PAGE_FULL, HHANCLUB_FILELIST_FRAGMENT } from "@umt/testkit";
|
||||
import {
|
||||
HHANCLUB_DETAIL_PAGE_2026,
|
||||
HHANCLUB_DETAIL_PAGE_FULL,
|
||||
HHANCLUB_DETAIL_PAGE_REAL_2026,
|
||||
HHANCLUB_FILELIST_FRAGMENT,
|
||||
} from "@umt/testkit";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { hhanclubDefinition } from "../definitions/index.ts";
|
||||
import { looksLikeMediaInfo, pageFromBbcode } from "../detail-text.ts";
|
||||
@@ -109,6 +114,30 @@ Format : AVC[/quote]
|
||||
});
|
||||
});
|
||||
|
||||
describe("憨憨真实详情页(2026-10-02 摘录)", () => {
|
||||
const { detail } = parseDetailPage(HHANCLUB_DETAIL_PAGE_REAL_2026, hhanclubDefinition, "219860", OBSERVED);
|
||||
const page = detail!.page!;
|
||||
|
||||
it("MediaInfo 只取 #mediainfo-raw 原文,不带摘要表", () => {
|
||||
expect(page.mediaInfo!.startsWith("General\nComplete name")).toBe(true);
|
||||
expect(page.mediaInfo).not.toContain("体 积");
|
||||
});
|
||||
|
||||
it("豆瓣块一项一行;去掉分隔线、空值项、标题行与更新提示;链接之间已有逗号不再补分隔", () => {
|
||||
const t = page.descriptionText!;
|
||||
expect(t.split("\n").slice(0, 3)).toEqual([
|
||||
"片名: 斗罗大陆Ⅱ绝世唐门 年番1",
|
||||
"别名: 斗罗大陆2,斗罗大陆2:绝世唐门\u200e,斗罗大陆2绝世唐门,绝世唐门动画版",
|
||||
"年代: 2023",
|
||||
]);
|
||||
expect(t).toContain("\n导演: 沈乐平 Leping Shen\n");
|
||||
expect(t).toContain("编剧: 沈乐平 Leping Shen,唐家三少 Wei Zhang");
|
||||
expect(t).toContain("主演:\n梁达伟 Dawei Liang / 蒋丽 Li Jiang");
|
||||
expect(t).not.toMatch(/-{5,}|标语|该信息最后更新|\(23691\)/);
|
||||
expect(page.doubanId).toBe("35567787");
|
||||
});
|
||||
});
|
||||
|
||||
describe("详情页扩展内容(憨憨 2026 真实结构:分节 div,无 #kdescr)", () => {
|
||||
const { kind, detail } = parseDetailPage(HHANCLUB_DETAIL_PAGE_2026, hhanclubDefinition, "91003", OBSERVED);
|
||||
const page = detail!.page!;
|
||||
|
||||
Reference in new issue
Block a user