fix(source): do not mix es/mx in Cuevana
This commit is contained in:
parent
731167efa8
commit
bd67664827
3 changed files with 104 additions and 2 deletions
|
|
@ -35,4 +35,14 @@ describe('Cuevana', () => {
|
|||
const streams = await handler.handle(ctx, 'movie', new TmdbId(559969, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('does not return mx content for es', async () => {
|
||||
const streams = await handler.handle(createTestContext({ es: 'on' }), 'movie', new TmdbId(559969, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('does not return es content for mx', async () => {
|
||||
const streams = await handler.handle(createTestContext({ mx: 'on' }), 'movie', new TmdbId(559969, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,11 +51,18 @@ export class Cuevana implements Source {
|
|||
|
||||
const urlResults = $('.open_submenu')
|
||||
.map((_i, el) => {
|
||||
if ($(el).text().includes('Español Latino') && CountryCode.mx in ctx.config) {
|
||||
const elText = $(el).text();
|
||||
if (!elText.includes('Español')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const isLatino = elText.includes('Latino');
|
||||
|
||||
if (isLatino && CountryCode.mx in ctx.config) {
|
||||
return $('[data-tr], [data-video]', el)
|
||||
.map((_i, el) => ({ countryCode: CountryCode.mx, title, url: new URL($(el).attr('data-tr') ?? $(el).attr('data-video') as string) }))
|
||||
.toArray();
|
||||
} else if ($(el).text().includes('Español') && CountryCode.es in ctx.config) {
|
||||
} else if (!isLatino && CountryCode.es in ctx.config) {
|
||||
return $('[data-tr], [data-video]', el)
|
||||
.map((_i, el) => ({ countryCode: CountryCode.es, title, url: new URL($(el).attr('data-tr') ?? $(el).attr('data-video') as string) }))
|
||||
.toArray();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,90 @@
|
|||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`Cuevana does not return es content for mx 1`] = `
|
||||
[
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://streamwish.to/e/9icce2ca0yir",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://filemoon.sx/e/fgxxkidqq4jp",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://voe.sx/e/h87m8wyj5x8j",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://doodstream.com/e/ju53ufkqy9hc",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://streamtape.com/e/WgxgBAwOyGfbZxY",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://waaw.to/f/xtG7M9GL2MmV",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://filelions.to/v/tnehp8g7zght",
|
||||
},
|
||||
{
|
||||
"countryCode": "mx",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://plustream.com/embedb2/gHHRwqKdHgF5MYniuxGWnG8j_vIW77uC4a4vrO5iwLktMwS8ryr2i.bhH3SiGHw6PKNBoqxCHLDyc1Pw6EPhwg--",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Cuevana does not return mx content for es 1`] = `
|
||||
[
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://streamwish.to/e/mtb09rms1njz",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://filemoon.sx/e/r77fu9ez9nsv",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://voe.sx/e/cepsnqy0qgyo",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://doodstream.com/e/ny5qlz61x9xt",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://waaw.to/f/hlHhgFkmWHom",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://plustream.com/embedb2/DpAUEfJrAHkBAdb.6erU25OAypGXqMugDfQuWU2sTDBKHNQmIxzyq1b2Ma06kb7EgL6d4hdzw8quWDimAGnIvQ--",
|
||||
},
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "El Camino: Una película de Breaking Bad",
|
||||
"url": "https://vidhidepro.com/v/lhaueh479t2v",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Cuevana handle el camino 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue