fix(source): do alternative dash search for HomeCine
This commit is contained in:
parent
747ea84880
commit
bfdb212770
7 changed files with 2324 additions and 7 deletions
|
|
@ -31,6 +31,11 @@ describe('HomeCine', () => {
|
|||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('handle marvel - the punisher', async () => {
|
||||
const streams = await source.handle(createTestContext({ es: 'on' }), 'movie', new TmdbId(67178, 1, 1));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('does not return mx content for es', async () => {
|
||||
const streams = await source.handle(createTestContext({ es: 'on' }), 'movie', new TmdbId(559969, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
|
|
|
|||
|
|
@ -62,18 +62,28 @@ export class HomeCine implements Source {
|
|||
}).toArray();
|
||||
};
|
||||
|
||||
private readonly fetchPageUrl = async (ctx: Context, keyword: string, year: number, tmdbId: TmdbId): Promise<URL | undefined> => {
|
||||
const searchUrl = new URL(`/?s=${encodeURIComponent(keyword)}`, this.baseUrl);
|
||||
private readonly fetchPageUrl = async (ctx: Context, name: string, year: number, tmdbId: TmdbId): Promise<URL | undefined> => {
|
||||
const searchUrl = new URL(`/?s=${encodeURIComponent(name)}`, this.baseUrl);
|
||||
|
||||
const html = await this.fetcher.text(ctx, searchUrl);
|
||||
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
const urls = $(`a[oldtitle="${keyword} (${year})"], a[oldtitle="${keyword}"]`)
|
||||
.filter((_i, el) => $(el).siblings('#hidden_tip').find(`a[href$="release-year/${year}"]`).length !== 0)
|
||||
.map((_i, el) => new URL($(el).attr('href') as string))
|
||||
.toArray()
|
||||
.filter(url => tmdbId.season ? url.href.includes('/series/') : !url.href.includes('/series/'));
|
||||
const keywords = [
|
||||
name,
|
||||
name.replace('-', '–'),
|
||||
];
|
||||
|
||||
const urls: URL[] = [];
|
||||
keywords.map((keyword) => {
|
||||
urls.push(
|
||||
...$(`a[oldtitle="${keyword} (${year})"], a[oldtitle="${keyword}"]`)
|
||||
.filter((_i, el) => $(el).siblings('#hidden_tip').find(`a[href$="release-year/${year}"]`).length !== 0)
|
||||
.map((_i, el) => new URL($(el).attr('href') as string))
|
||||
.toArray()
|
||||
.filter(url => tmdbId.season ? url.href.includes('/series/') : !url.href.includes('/series/')),
|
||||
);
|
||||
});
|
||||
|
||||
return urls[0];
|
||||
};
|
||||
|
|
|
|||
1
src/source/__fixtures__/HomeCine/https:api.themoviedb.org3tv67178languagees
generated
Normal file
1
src/source/__fixtures__/HomeCine/https:api.themoviedb.org3tv67178languagees
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"adult":false,"backdrop_path":"/jBGjbSDRxOEudW9rmQbWDzJUKq9.jpg","created_by":[{"id":1240816,"credit_id":"580d4a20c3a3682286013d6b","name":"Steve Lightfoot","original_name":"Steve Lightfoot","gender":2,"profile_path":"/2CPBXSicKlQO0xnhmYgEhWUGL42.jpg"}],"episode_run_time":[53],"first_air_date":"2017-11-17","genres":[{"id":10759,"name":"Action & Adventure"},{"id":80,"name":"Crimen"},{"id":18,"name":"Drama"}],"homepage":"https://www.disneyplus.com/series/the-punisher/6JOZHgU6cBS3","id":67178,"in_production":false,"languages":["en"],"last_air_date":"2019-01-18","last_episode_to_air":{"id":1675739,"name":"El torbellino","overview":"Frank, Pilgrim, Madani, Russo, Amy, Curt y la familia Schultz. La conclusión explosiva de la segunda temporada no escatima en munición.","vote_average":8.228,"vote_count":57,"air_date":"2019-01-18","episode_number":13,"episode_type":"finale","production_code":"","runtime":57,"season_number":2,"show_id":67178,"still_path":"/oqu7NwokmhEQRCplas6wixHJ9H2.jpg"},"name":"Marvel - The Punisher","next_episode_to_air":null,"networks":[{"id":213,"logo_path":"/wwemzKWzjKYJFfCeiB57q3r4Bcm.png","name":"Netflix","origin_country":""}],"number_of_episodes":26,"number_of_seasons":2,"origin_country":["US"],"original_language":"en","original_name":"Marvel's The Punisher","overview":"Un antiguo marine decidido a castigar a los asesinos de su familia termina atrapado en una conspiración militar.","popularity":17.2499,"poster_path":"/8OdIbo68mFE4w6jXA20aL8ocPsE.jpg","production_companies":[{"id":38679,"logo_path":"/v2y3LuLxYtW36hvLa8IDGQk3Oql.png","name":"Marvel Television","origin_country":"US"},{"id":19366,"logo_path":"/vOH8dyQhLK01pg5fYkgiS31jlFm.png","name":"ABC Studios","origin_country":"US"},{"id":156964,"logo_path":null,"name":"Bohemian Risk Productions","origin_country":"US"}],"production_countries":[{"iso_3166_1":"US","name":"United States of America"}],"seasons":[{"air_date":"2017-11-17","episode_count":13,"id":78693,"name":"Temporada 1","overview":"Tras vengarse de los responsables de la muerte de su mujer y sus hijos, tomándose la justicia por su mano, Frank Castle descubre una conspiración que va mucho más allá del submundo criminal de Nueva York. Ahora conocido en toda la ciudad como el Castigador, debe descubrir la verdad sobre injusticias que afectan más familias aparte de la suya propia.","poster_path":"/ngg9srI1F4op7bRHX33QJhls9zq.jpg","season_number":1,"vote_average":8.0},{"air_date":"2019-01-18","episode_count":13,"id":115281,"name":"Temporada 2","overview":"Frank Castle, ex marine convertido en vigilante, llevaba una vida tranquila en la carretera hasta que, de repente, tiene que salvar a una joven chica de ser asesinada. A medida que se ve envuelto en el misterio que rodea a la joven y a aquellos que persiguen la información que ella posee, Castle atrae un nuevo objetivo a su espalda mientras nuevos y viejos enemigos le obligan a enfrentarse a si debe aceptar su destino y abrazar la vida como \"El Castigador\".","poster_path":"/kMYg7RbRYjzv9xQbkSg70G7fIM3.jpg","season_number":2,"vote_average":8.0}],"spoken_languages":[{"english_name":"English","iso_639_1":"en","name":"English"}],"status":"Canceled","tagline":"","type":"Scripted","vote_average":8.1,"vote_count":2825}
|
||||
925
src/source/__fixtures__/HomeCine/https:www3.homecine.toepisodemarvel-the-punisher-temporada-1-capitulo-1
generated
Normal file
925
src/source/__fixtures__/HomeCine/https:www3.homecine.toepisodemarvel-the-punisher-temporada-1-capitulo-1
generated
Normal file
File diff suppressed because one or more lines are too long
405
src/source/__fixtures__/HomeCine/https:www3.homecine.tosMarvelpercent20-percent20Thepercent20Punisher
generated
Normal file
405
src/source/__fixtures__/HomeCine/https:www3.homecine.tosMarvelpercent20-percent20Thepercent20Punisher
generated
Normal file
File diff suppressed because one or more lines are too long
961
src/source/__fixtures__/HomeCine/https:www3.homecine.toseriesmarvel-the-punisher
generated
Normal file
961
src/source/__fixtures__/HomeCine/https:www3.homecine.toseriesmarvel-the-punisher
generated
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -35,6 +35,16 @@ exports[`HomeCine handle el camino 1`] = `
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`HomeCine handle marvel - the punisher 1`] = `
|
||||
[
|
||||
{
|
||||
"countryCode": "es",
|
||||
"title": "Marvel - The Punisher 1x1",
|
||||
"url": "https://fastream.to/embed-ujq9uojoftog.html",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`HomeCine handle walking dead s1e1 1`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue