feat(adapters): port MoviePilot open site framework (7 spiders, 20 user parsers) + MovieClaw v0.27.0 site definitions + mp-sync tools (W1-3c)
- sites/spiders: Haidan/HDDolby/RousiPro/SunnyPT/TNode/TorrentLeech/Yema (+mTorrent wrapper), specialized SiteAdapter, indirect download resolved at download time - sites/user-parsers: SiteParserBase + all 20 MP SiteSchema parsers (lxml XPath via xpath+xmldom), refreshSiteUserData with schema fallback - sites/definitions: zod SiteDefinition schemas, 23 MovieClaw v0.27.0 (MIT) definitions via scripts/mp-sync/movieclaw-import.mjs, registry getSiteDefinition/listSiteDefinitions, NOTICE - scripts/mp-sync: ledger.json (upstream sha256), check.mjs, build-ledger.mjs; docs/porting/mp-sync-ledger.md - license-and-provenance: add copied-mit kind, re-anchor MovieClaw rows to v0.27.0 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
cf85481d95
commit
d9f2af2f3c
166 files changed
+16577
-186
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { createMockFetch, DISCUZ_USER_INDEX, DISCUZ_USER_SEEDING, DISCUZ_USER_SPACE } from "@umt/testkit";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DiscuzUserInfo } from "./discuz.ts";
|
||||
import { runParser } from "./testing.ts";
|
||||
|
||||
describe("DiscuzUserInfo(MP discuz.py)", () => {
|
||||
it("&uid= 链接定位用户,空间页取等级/积分/流量,做种表按表头定位列", async () => {
|
||||
const m = createMockFetch({
|
||||
"/": { body: DISCUZ_USER_INDEX },
|
||||
"/home.php?uid=42": { body: DISCUZ_USER_SPACE },
|
||||
"/forum.php?mod=torrents": { body: DISCUZ_USER_SEEDING },
|
||||
});
|
||||
const info = await runParser(DiscuzUserInfo, { fetch: m.fetch });
|
||||
expect(info).toMatchObject({
|
||||
schema: "DiscuzX",
|
||||
userId: "42",
|
||||
username: "frank",
|
||||
userLevel: "Lv3",
|
||||
joinAt: "2018-02-03 04:05:00",
|
||||
bonus: 520,
|
||||
upload: 2 * 1024 ** 4,
|
||||
download: 500 * 1024 ** 3,
|
||||
seeding: 1,
|
||||
seedingInfo: [[6, 8 * 1024 ** 3]],
|
||||
});
|
||||
});
|
||||
|
||||
it("未登录(无登出链接):errMsg", async () => {
|
||||
const m = createMockFetch({
|
||||
"/": { body: "<html><body><a href='member.php?mod=logging&action=login'>登录</a></body></html>" },
|
||||
});
|
||||
const info = await runParser(DiscuzUserInfo, { fetch: m.fetch });
|
||||
expect(info.errMsg).toContain("未检测到已登陆");
|
||||
expect(info.userId).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user