feat(sites): extract douban IDs from list rows (audiences) (ID-3)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-10-01 00:15:20 +08:00
1 parent a6d655d2ce
commit cba214e93e
5 files changed
+62 -1

No files matched your search

@@ -0,0 +1,30 @@
/**
* ID-3 列表页外部 ID:观众列表行右侧的评分徽标带 IMDb / 豆瓣链接(DET-2 列表样本 rl-audiences-list,脱敏)。
* imdbid 是 MP 字段;doubanid 是 UMT 扩展字段(MP SiteSpider 不读,索引差分只比 MP 字段,不受影响)。
*/
import { describe, expect, it } from "vitest";
import { audiencesDefinition, SiteSpider } from "../../src/sites/index.ts";
import { spiderTorrentToRelease } from "../../src/sites/spider/map.ts";
import { readInput } from "./diff-util.ts";
describe("观众列表页:IMDb / 豆瓣 ID(真实样本)", () => {
const html = readInput("inputs/indexer/rl-audiences-list.html.txt");
const rows = new SiteSpider(audiencesDefinition, {}).parse(html).torrents;
const byId = (id: string) => rows.find((r) => r.page_url?.includes(`id=${id}&`));
it("有豆瓣徽标的行都抽到豆瓣 ID,有 IMDb 徽标的抽到 IMDb", () => {
expect(byId("725858")).toMatchObject({ imdbid: "tt25399154", doubanid: "35322132" });
expect(byId("726249")).toMatchObject({ imdbid: "tt0039689", doubanid: "1302338" });
// 剧集行只有豆瓣(IMDb 在详情页里)
const prophet = byId("727077")!;
expect(prophet.doubanid).toBe("37297001");
expect(prophet.imdbid).toBeUndefined();
expect(rows.filter((r) => r.doubanid).length).toBe(10);
});
it("映射到 SiteRelease.doubanId / imdbId", () => {
const r = spiderTorrentToRelease(byId("727077")!, audiencesDefinition, "2026-09-30T00:00:00.000Z");
expect(r).toMatchObject({ siteReleaseId: "727077", doubanId: "37297001" });
expect(r?.imdbId).toBeUndefined();
});
});