chore(source): improve Eurostreaming (IT) search with multi-word keyword

This commit is contained in:
WebStreamr 2025-06-15 18:27:37 +00:00
parent 21467ac670
commit a4ceca57ae
No known key found for this signature in database
6 changed files with 2269 additions and 1 deletions

View file

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

View file

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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`] = `
[
{