fix(handler): return only results for configured country/language in CineHDPlus
This commit is contained in:
parent
8367b7d6e1
commit
ac8dd43662
2 changed files with 11 additions and 0 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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}"]`)
|
||||
|
|
|
|||
Loading…
Reference in a new issue