From ac8dd436623f23f3f496354d99faf697b1c13033 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Wed, 21 May 2025 15:44:37 +0000 Subject: [PATCH] fix(handler): return only results for configured country/language in CineHDPlus --- src/handler/CineHDPlus.test.ts | 8 ++++++++ src/handler/CineHDPlus.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/handler/CineHDPlus.test.ts b/src/handler/CineHDPlus.test.ts index ff9d85b..c43bcdb 100644 --- a/src/handler/CineHDPlus.test.ts +++ b/src/handler/CineHDPlus.test.ts @@ -71,4 +71,12 @@ describe('CineHDPlus', () => { }); expect(streams[1]?.url.href).toMatch(/^https:\/\/.*?.m3u8/); }); + + test('does not return mx results for es and vice-versa', async () => { + const streamsEs = (await handler.handle({ ...ctx, ...{ config: { es: 'on' } } }, 'series', 'tt2085059:2:3')).filter(stream => stream !== undefined); + expect(streamsEs).toHaveLength(0); + + const streamsMx = (await handler.handle({ ...ctx, ...{ config: { mx: 'on' } } }, 'series', 'tt0105946:2:3')).filter(stream => stream !== undefined); + expect(streamsMx).toHaveLength(0); + }); }); diff --git a/src/handler/CineHDPlus.ts b/src/handler/CineHDPlus.ts index b855823..f8ed645 100644 --- a/src/handler/CineHDPlus.ts +++ b/src/handler/CineHDPlus.ts @@ -38,6 +38,9 @@ export class CineHDPlus implements Handler { const $ = cheerio.load(html); const countryCode = ($('.details__langs').html() as string).includes('Latino') ? 'mx' : 'es'; + if (!(countryCode in ctx.config)) { + return []; + } return Promise.all( $(`[data-num="${imdbId.series}x${imdbId.episode}"]`)