chore(handler): generalize KinoGer to support more (external) URLs
This commit is contained in:
parent
141c737cf3
commit
42950bc2a3
9 changed files with 86 additions and 17 deletions
|
|
@ -34,26 +34,18 @@ export class KinoGer implements Handler {
|
|||
return [];
|
||||
}
|
||||
|
||||
const html = await this.fetcher.text(ctx, pageUrl);
|
||||
|
||||
const fsstJs = html.match(/fsst\.show\(.*/);
|
||||
if (!fsstJs) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const title = tmdbId.season ? `${keyword} ${tmdbId.season}x${tmdbId.episode}` : `${keyword} (${year})`;
|
||||
const seasonIndex = (tmdbId.season ?? 1) - 1;
|
||||
const episodeIndex = (tmdbId.episode ?? 1) - 1;
|
||||
|
||||
const episodeUrl = this.findEpisodeUrlInShowJs(fsstJs[0], seasonIndex, episodeIndex);
|
||||
if (!episodeUrl) {
|
||||
return [];
|
||||
}
|
||||
const html = await this.fetcher.text(ctx, pageUrl);
|
||||
|
||||
const title = tmdbId.season ? `${keyword} ${tmdbId.season}x${tmdbId.episode}` : `${keyword} (${year})`;
|
||||
|
||||
return [
|
||||
await this.extractorRegistry.handle({ ...ctx, referer: pageUrl }, episodeUrl, { countryCode: 'de', title }),
|
||||
];
|
||||
return Promise.all(
|
||||
Array.from(html.matchAll(/\.show\(.*/g))
|
||||
.map(showJsMatch => this.findEpisodeUrlInShowJs(showJsMatch[0], seasonIndex, episodeIndex))
|
||||
.filter(url => url !== undefined && !['kinoger.be', 'kinoger.ru'].includes(url.host))
|
||||
.map(async url => await this.extractorRegistry.handle({ ...ctx, referer: pageUrl }, url as URL, { countryCode: 'de', title })),
|
||||
);
|
||||
};
|
||||
|
||||
private readonly findEpisodeUrlInShowJs = (showJs: string, seasonIndex: number, episodeIndex: number): URL | undefined => {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,32 @@ exports[`KinoGer handle imdb blood and sinners 1`] = `
|
|||
"url": "https://www.secvideo1.online/get_file/16/fae180e05d8d7af50fff44c7a24232b522db464935/900000/900576/900576.mp4/",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"error": [Error: Fetcher error: 404: Not Found],
|
||||
"isExternal": true,
|
||||
"label": "kinoger.pw",
|
||||
"meta": {
|
||||
"countryCode": "de",
|
||||
"title": "Blood & Sinners (2025)",
|
||||
},
|
||||
"sourceId": "external",
|
||||
"url": "https://kinoger.pw/e/6zeREaMlrqREZPa",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"isExternal": true,
|
||||
"label": "kinoger.re",
|
||||
"meta": {
|
||||
"countryCode": "de",
|
||||
"title": "Blood & Sinners (2025)",
|
||||
},
|
||||
"sourceId": "external_de",
|
||||
"ttl": 3600000,
|
||||
"url": "https://kinoger.re/#ge5fhb",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
|
|
@ -51,6 +77,19 @@ exports[`KinoGer handle imdb dead city s2e5 1`] = `
|
|||
"url": "https://hfs308.serversicuro.cc/hls/,dnzpe7rf5xg4a3gyva3h5orlyw23xosfzwunl5xbmjpz3lspgri6ztlr5dia,.urlset/master.m3u8",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"isExternal": true,
|
||||
"label": "kinoger.re",
|
||||
"meta": {
|
||||
"countryCode": "de",
|
||||
"title": "The Walking Dead: Dead City 2x5",
|
||||
},
|
||||
"sourceId": "external_de",
|
||||
"ttl": 3600000,
|
||||
"url": "https://kinoger.re/#x6tsx9",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
|
|
@ -88,9 +127,40 @@ exports[`KinoGer handle imdb dead city s2e6 1`] = `
|
|||
"url": "https://www.secvideo1.online/get_file/9/44ff1bf6024db32840054f00029afb114120b91353/901000/901994/901994.mp4/",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"isExternal": true,
|
||||
"label": "kinoger.re",
|
||||
"meta": {
|
||||
"countryCode": "de",
|
||||
"title": "The Walking Dead: Dead City 2x6",
|
||||
},
|
||||
"sourceId": "external_de",
|
||||
"ttl": 3600000,
|
||||
"url": "https://kinoger.re/#ep1tcf",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`KinoGer handle missing episode imdb black mirror s3e4 1`] = `[]`;
|
||||
|
||||
exports[`KinoGer handle no fsst via brokeback mountain 1`] = `[]`;
|
||||
exports[`KinoGer handle no fsst via brokeback mountain 1`] = `
|
||||
[
|
||||
[
|
||||
{
|
||||
"label": "DoodStream",
|
||||
"meta": {
|
||||
"countryCode": "de",
|
||||
"title": "Brokeback Mountain (2005)",
|
||||
},
|
||||
"requestHeaders": {
|
||||
"Referer": "http://dood.to/",
|
||||
},
|
||||
"sourceId": "doodstream_de",
|
||||
"ttl": 900000,
|
||||
"url": "https://ijs155l.cloudatacdn.com/u5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aq/ntfyct66ci~mocked-random-string?token=fbsg3301phkef2s4swo8bssg&expiry=639837296000",
|
||||
},
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error
generated
Normal file
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fetcher error: 404: Not Found
|
||||
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf
generated
Normal file
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb
generated
Normal file
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9
generated
Normal file
1
src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{}
|
||||
1
src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr
generated
Normal file
1
src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr
generated
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
https://ijs155l.cloudatacdn.com/u5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aq/ntfyct66ci~
|
||||
Loading…
Reference in a new issue