From f4a0b0324611399f26fb160b19ea2441cd8faaee Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Fri, 23 May 2025 09:20:20 +0000 Subject: [PATCH] fix(handler): do not ignore main link in Eurostreaming --- src/handler/Eurostreaming.ts | 19 +++++++++++-------- .../__snapshots__/Eurostreaming.test.ts.snap | 8 ++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/handler/Eurostreaming.ts b/src/handler/Eurostreaming.ts index 4db42cd..a185215 100644 --- a/src/handler/Eurostreaming.ts +++ b/src/handler/Eurostreaming.ts @@ -37,14 +37,17 @@ export class Eurostreaming implements Handler { const $ = cheerio.load(html); - return Promise.all( - $(`[data-num="${imdbId.series}x${imdbId.episode}"]`) - .siblings('.mirrors') - .children('[data-link!="#"]') - .map((_i, el) => new URL(($(el).attr('data-link') as string).replace(/^(https:)?\/\//, 'https://'))) - .toArray() - .filter(url => !url.host.match(/eurostreaming/)) - .map(url => this.extractorRegistry.handle(ctx, url, 'it')), + const mainDataLinkElements = $(`[data-num="${imdbId.series}x${imdbId.episode}"][data-link!="#"]`); + const mirrorDataLinkElements = $(`[data-num="${imdbId.series}x${imdbId.episode}"]`) + .siblings('.mirrors') + .children('[data-link!="#"]'); + + return Promise.all(mainDataLinkElements + .add(mirrorDataLinkElements) + .map((_i, el) => new URL(($(el).attr('data-link') as string).replace(/^(https:)?\/\//, 'https://'))) + .toArray() + .filter(url => !url.host.match(/eurostreaming/)) + .map(url => this.extractorRegistry.handle(ctx, url, 'it')), ); }; diff --git a/src/handler/__snapshots__/Eurostreaming.test.ts.snap b/src/handler/__snapshots__/Eurostreaming.test.ts.snap index 89b77a5..6b8c76b 100644 --- a/src/handler/__snapshots__/Eurostreaming.test.ts.snap +++ b/src/handler/__snapshots__/Eurostreaming.test.ts.snap @@ -10,6 +10,14 @@ exports[`Eurostreaming handle imdb black mirror s2e4 1`] = ` "sourceId": "supervideo_it", "url": "https://hfs309.serversicuro.cc/hls/dnzpdeoe5xg4a3gyvaqx5ojpswtxjd5a22rklgah7,khdhascykjrixs7huqq,obtfascykj3vna7rk5a,.urlset/master.m3u8", }, + { + "bytes": 875875532, + "countryCode": "it", + "height": 1080, + "label": "SuperVideo", + "sourceId": "supervideo_it", + "url": "https://hfs309.serversicuro.cc/hls/dnzpdeoe5xg4a3gyvaqx5ojpswtxjd5a22rklgah7,khdhascykjrixs7huqq,obtfascykj3vna7rk5a,.urlset/master.m3u8", + }, { "bytes": 875875532, "countryCode": "it",