fix(handler): return only results for configured country/language in CineHDPlus

This commit is contained in:
WebStreamr 2025-05-21 15:44:37 +00:00
parent 8367b7d6e1
commit ac8dd43662
No known key found for this signature in database
2 changed files with 11 additions and 0 deletions

View file

@ -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);
});
});

View file

@ -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}"]`)