From 42950bc2a38bb880a4c272ba87deb2c68655450a Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Tue, 10 Jun 2025 15:48:31 +0000 Subject: [PATCH] chore(handler): generalize KinoGer to support more (external) URLs --- src/handler/KinoGer.ts | 24 +++---- .../__snapshots__/KinoGer.test.ts.snap | 72 ++++++++++++++++++- ...g3301phkef2s4swo8bssgandexpiry639837296000 | 1 + ...ead-https:kinoger.pwe6zeREaMlrqREZPa.error | 1 + .../Fetcher/head-https:kinoger.reep1tcf | 1 + .../Fetcher/head-https:kinoger.rege5fhb | 1 + .../Fetcher/head-https:kinoger.rex6tsx9 | 1 + ...p:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr | 1 + ...57eccc2cc64152bd37fbsg3301phkef2s4swo8bssg | 1 + 9 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 src/utils/__fixtures__/Fetcher/head-https:ijs155l.cloudatacdn.comu5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aqntfyct66ci~mocked-random-stringtokenfbsg3301phkef2s4swo8bssgandexpiry639837296000 create mode 100644 src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error create mode 100644 src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf create mode 100644 src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb create mode 100644 src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9 create mode 100644 src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr create mode 100644 src/utils/__fixtures__/Fetcher/http:dood.topass_md5143414074-37-24-1749570077-a29102f4bf1a4d57eccc2cc64152bd37fbsg3301phkef2s4swo8bssg diff --git a/src/handler/KinoGer.ts b/src/handler/KinoGer.ts index 6de386d..d66fb3b 100644 --- a/src/handler/KinoGer.ts +++ b/src/handler/KinoGer.ts @@ -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 => { diff --git a/src/handler/__snapshots__/KinoGer.test.ts.snap b/src/handler/__snapshots__/KinoGer.test.ts.snap index 7ee4608..1c8409b 100644 --- a/src/handler/__snapshots__/KinoGer.test.ts.snap +++ b/src/handler/__snapshots__/KinoGer.test.ts.snap @@ -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", + }, + ], +] +`; diff --git a/src/utils/__fixtures__/Fetcher/head-https:ijs155l.cloudatacdn.comu5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aqntfyct66ci~mocked-random-stringtokenfbsg3301phkef2s4swo8bssgandexpiry639837296000 b/src/utils/__fixtures__/Fetcher/head-https:ijs155l.cloudatacdn.comu5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aqntfyct66ci~mocked-random-stringtokenfbsg3301phkef2s4swo8bssgandexpiry639837296000 new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/head-https:ijs155l.cloudatacdn.comu5kj2rz5qtdlsdgge4hrgj2flz5cjodea6auatveaphxodkbf5n5mtrbp7aqntfyct66ci~mocked-random-stringtokenfbsg3301phkef2s4swo8bssgandexpiry639837296000 @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error b/src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error new file mode 100644 index 0000000..c31051e --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/head-https:kinoger.pwe6zeREaMlrqREZPa.error @@ -0,0 +1 @@ +Fetcher error: 404: Not Found \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf b/src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/head-https:kinoger.reep1tcf @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb b/src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/head-https:kinoger.rege5fhb @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9 b/src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9 new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/head-https:kinoger.rex6tsx9 @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr b/src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr new file mode 100644 index 0000000..ce18c04 --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/http:dood.toe1cfcevn6dg8shrfvht22odxw2lty18hr @@ -0,0 +1 @@ +
video you are looking for is not found.