feat(adapters): RSS and PT site adapters ported from MoviePilot v3 + mocks (W1-3b)
- rss: port of MP RssHelper._parse_impl/get_rss_link semantics with safe XML (entities off, DTD/ENTITY rejected, size/item caps), ETag/Last-Modified, backoff + Retry-After, circuit breaker with manual reset, passkey redaction, overlap-window GUID+digest dedupe - sites/spider: TS port of MP SiteSpider (indexer schema, search URL builder, field DSL, filters, Jinja templates via nunjucks, login-page detection); audiences definition hand-written as JSON; raw category id preserved; shared per-site token bucket - sites/mteam: port of MP MTorrentSpider (params, result mapping, promo factors, genDlToken flow) without embedding the API key in enclosures; business code/message checks - testkit: mock RSS server, mock NexusPHP site, mock M-Team API - docs: W1-3b migration mapping appended to porting ledger Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
ef2e504a94
commit
a6d049db81
47 files changed
+5414
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# testkit/sites
|
||||
|
||||
mock PT 站点(配合 adapters/sites 的 MoviePilot 迁移实现)。HTML/JSON fixture 为自行编写,**不代表已核对真实站点**,只用于验证适配器的选择器配置与错误分类。
|
||||
|
||||
## mock NexusPHP(观众风格)
|
||||
|
||||
```ts
|
||||
const site = await createMockNexusPhpSite({ pageSize: 50, pageBase: 0, loginMode: "page" | "redirect" });
|
||||
site.baseUrl; site.cookie; // 请求 Cookie 需包含 site.cookie
|
||||
site.setLoggedIn(false); // 全站返回登录页(或 302 login.php)
|
||||
site.failNext(1, 429, "7"); // 限流 / 5xx
|
||||
site.setBrokenLayout(true); // 改版模拟
|
||||
site.infoHashOf("812345"); // 下载 .torrent 的 infohash
|
||||
```
|
||||
|
||||
路由:`index.php`、`torrents.php`(search / catN / spstate=2 / page)、`details.php?id=`(不存在返回"没有该ID的种子")、`download.php?id=`(合法 .torrent,或 `magnet` 字段时 302 磁力)、`login.php`。
|
||||
默认 fixture `AUDIENCES_FIXTURE_RELEASES`:免费+截止(812345)、综艺 403 + H&R(812346)、50%+2x(812347)、截断标题 + TB(812348)、纪录片 2x + KB(812349)。
|
||||
|
||||
## mock M-Team API
|
||||
|
||||
```ts
|
||||
const api = await createMockMteamApi({ apiKey, torrents, failMode });
|
||||
api.setFailMode("banned_key" | "rate_limit" | "http_429" | "non_json" | "no_dl_token" | null);
|
||||
api.lastSearchBody; api.issuedTokens; api.infoHashOf("912233");
|
||||
```
|
||||
|
||||
路由:`POST /api/torrent/search`、`/api/torrent/detail`、`/api/torrent/genDlToken`(id 可走 query 或表单,签发一次性 `/api/rss/dlv2?sign=&t=&tid=`)、`/api/member/profile`;`x-api-key` 错误返回 `{code:"1", message:"key無效"}`。
|
||||
默认 fixture `MTEAM_FIXTURE_TORRENTS`:50% 限时(912233)、商城单种免费(912234)、全站促销(912235,动画 405)、2x 免费(912236,纪录 404)、体育 407(912237)。
|
||||
|
||||
`buildFakeTorrent({name, length})` 生成结构合法的 .torrent 与其 infohash。
|
||||
Reference in new issue
Block a user