chore(source): improve Eurostreaming (IT) search with multi-word keyword
This commit is contained in:
parent
21467ac670
commit
a4ceca57ae
6 changed files with 2269 additions and 1 deletions
|
|
@ -30,4 +30,9 @@ describe('Eurostreaming', () => {
|
|||
const streams = await handler.handle(ctx, 'series', new TmdbId(100088, 1, 1));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('game of thrones s1e1', async () => {
|
||||
const streams = await handler.handle(ctx, 'series', new TmdbId(1399, 1, 1));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ export class Eurostreaming implements Source {
|
|||
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
const url = $(`.post-thumb a[href][title="${keyword}"]:first`)
|
||||
const keywordWords = keyword.trim().split(/\s+/).filter(word => word.length > 0);
|
||||
|
||||
const url = (keywordWords.length > 1 ? $(`.post-thumb a[href][title*="${keyword}"]:first`) : $(`.post-thumb a[href][title="${keyword}"]:first`))
|
||||
.map((_i, el) => $(el).attr('href'))
|
||||
.get(0);
|
||||
|
||||
|
|
|
|||
1
src/source/__fixtures__/Eurostreaming/https:api.themoviedb.org3tv1399languageit
generated
Normal file
1
src/source/__fixtures__/Eurostreaming/https:api.themoviedb.org3tv1399languageit
generated
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,20 @@
|
|||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`Eurostreaming game of thrones s1e1 1`] = `
|
||||
[
|
||||
{
|
||||
"countryCode": "it",
|
||||
"title": "Il Trono di Spade 1x1",
|
||||
"url": "https://supervideo.cc/e/05jfivnr5hiw",
|
||||
},
|
||||
{
|
||||
"countryCode": "it",
|
||||
"title": "Il Trono di Spade 1x1",
|
||||
"url": "https://dropload.io/embed-dub8oh3k3yk5.html",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`Eurostreaming handle imdb black mirror s2e4 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue