fix(source): add fallback search for english title to Kokoshka
This commit is contained in:
parent
c4bf32f991
commit
331e5bd5d1
12 changed files with 69 additions and 4 deletions
|
|
@ -40,4 +40,9 @@ describe('Kokoshka', () => {
|
|||
const streams = await source.handle(ctx, 'movie', new TmdbId(1242404, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('handle our fault 2025', async () => {
|
||||
const streams = await source.handle(ctx, 'movie', new TmdbId(1156594, undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,9 +32,12 @@ export class Kokoshka extends Source {
|
|||
public async handleInternal(ctx: Context, _type: string, id: Id): Promise<SourceResult[]> {
|
||||
const tmdbId = await getTmdbId(ctx, this.fetcher, id);
|
||||
|
||||
let pageUrl = await this.fetchPageUrl(ctx, tmdbId);
|
||||
let pageUrl = await this.fetchPageUrl(ctx, tmdbId, 'sq');
|
||||
if (!pageUrl) {
|
||||
return [];
|
||||
pageUrl = await this.fetchPageUrl(ctx, tmdbId, 'en');
|
||||
if (!pageUrl) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
if (tmdbId.season) {
|
||||
|
|
@ -73,8 +76,8 @@ export class Kokoshka extends Source {
|
|||
);
|
||||
}
|
||||
|
||||
private readonly fetchPageUrl = async (ctx: Context, tmdbId: TmdbId): Promise<URL | undefined> => {
|
||||
const [name, year] = await getTmdbNameAndYear(ctx, this.fetcher, tmdbId, 'sq');
|
||||
private readonly fetchPageUrl = async (ctx: Context, tmdbId: TmdbId, language: string): Promise<URL | undefined> => {
|
||||
const [name, year] = await getTmdbNameAndYear(ctx, this.fetcher, tmdbId, language);
|
||||
|
||||
const searchUrl = new URL(`/?s=${encodeURIComponent(`${name.replace(':', '')} ${year}`)}`, this.baseUrl);
|
||||
const html = await this.fetcher.text(ctx, searchUrl);
|
||||
|
|
|
|||
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1156594languageen
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1156594languageen
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"adult":false,"backdrop_path":"/7QirCB1o80NEFpQGlQRZerZbQEp.jpg","belongs_to_collection":{"id":1156666,"name":"Fault Collection","poster_path":"/fR3AsfNeAmgGCy2CMFaOjIaIuA7.jpg","backdrop_path":"/7N9p8D39MXJDfm14zlBwW7mBh7g.jpg"},"budget":0,"genres":[{"id":10749,"name":"Romance"},{"id":18,"name":"Drama"}],"homepage":"https://www.amazon.com/gp/video/detail/B0DZF95RTJ","id":1156594,"imdb_id":"tt33311244","origin_country":["ES","US"],"original_language":"es","original_title":"Culpa nuestra","overview":"Jenna and Lion's wedding brings about the long-awaited reunion between Noah and Nick after their breakup. Nick's inability to forgive Noah stands as an insurmountable barrier. He, heir to his grandfather's businesses, and she, starting her professional life, resist fueling a flame that's still alive. But now that their paths have crossed again, will love be stronger than resentment?","popularity":323.8289,"poster_path":"/yzqHt4m1SeY9FbPrfZ0C2Hi9x1s.jpg","production_companies":[{"id":32485,"logo_path":"/fVXreZkiJTOq1cCi6htSQlPSy7R.png","name":"Pokeepsie Films","origin_country":"ES"},{"id":210099,"logo_path":"/d6HwljzlOzxJ4tXlrpRkNZaZMWL.png","name":"Amazon MGM Studios","origin_country":"US"}],"production_countries":[{"iso_3166_1":"ES","name":"Spain"},{"iso_3166_1":"US","name":"United States of America"}],"release_date":"2025-10-15","revenue":0,"runtime":112,"spoken_languages":[{"english_name":"Spanish","iso_639_1":"es","name":"Español"}],"status":"Released","tagline":"","title":"Our Fault","video":false,"vote_average":7.617,"vote_count":428}
|
||||
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1156594languagesq
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1156594languagesq
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"adult":false,"backdrop_path":"/7QirCB1o80NEFpQGlQRZerZbQEp.jpg","belongs_to_collection":{"id":1156666,"name":"Culpables - Colección","poster_path":"/fR3AsfNeAmgGCy2CMFaOjIaIuA7.jpg","backdrop_path":"/7N9p8D39MXJDfm14zlBwW7mBh7g.jpg"},"budget":0,"genres":[{"id":10749,"name":"Romance"},{"id":18,"name":"Drama"}],"homepage":"","id":1156594,"imdb_id":"tt33311244","origin_country":["ES","US"],"original_language":"es","original_title":"Culpa nuestra","overview":"","popularity":323.8289,"poster_path":"/6kmi6vmp6iOn4KzI7WfnVtAeJhU.jpg","production_companies":[{"id":32485,"logo_path":"/fVXreZkiJTOq1cCi6htSQlPSy7R.png","name":"Pokeepsie Films","origin_country":"ES"},{"id":210099,"logo_path":"/d6HwljzlOzxJ4tXlrpRkNZaZMWL.png","name":"Amazon MGM Studios","origin_country":"US"}],"production_countries":[{"iso_3166_1":"ES","name":"Spain"},{"iso_3166_1":"US","name":"United States of America"}],"release_date":"2025-10-15","revenue":0,"runtime":112,"spoken_languages":[{"english_name":"Spanish","iso_639_1":"es","name":"Español"}],"status":"Released","tagline":"","title":"Culpa nuestra","video":false,"vote_average":7.618,"vote_count":427}
|
||||
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1242404languageen
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3movie1242404languageen
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"adult":false,"backdrop_path":"/sb8Aq1RohASXyjT0uEOUUZJi5oI.jpg","belongs_to_collection":null,"budget":0,"genres":[{"id":18,"name":"Drama"}],"homepage":"https://www.netflix.com/title/81745480","id":1242404,"imdb_id":"tt32985279","origin_country":["IE"],"original_language":"en","original_title":"Steve","overview":"Over one intense day, the devoted head teacher of a last-chance reform school strives to keep his students in line while facing pressures of his own.","popularity":13.0327,"poster_path":"/wmLoMyofbseLfxiGgk1Iz5H97c3.jpg","production_companies":[{"id":196153,"logo_path":"/rdZiokZcHdb51C0uCTDjJyUBfc4.png","name":"Big Things Films","origin_country":"IE"}],"production_countries":[{"iso_3166_1":"IE","name":"Ireland"}],"release_date":"2025-09-19","revenue":0,"runtime":92,"spoken_languages":[{"english_name":"English","iso_639_1":"en","name":"English"}],"status":"Released","tagline":"A quiet storm of emotion.","title":"Steve","video":false,"vote_average":6.396,"vote_count":134}
|
||||
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3tv287877languageen
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:api.themoviedb.org3tv287877languageen
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"adult":false,"backdrop_path":"/olKSgSZVyDjqd11Bgv1lMk36Jm7.jpg","created_by":[{"id":5476237,"credit_id":"683c0c2b6f2cd45f867ba527","name":"Judith Westermann","original_name":"Judith Westermann","gender":0,"profile_path":null}],"episode_run_time":[],"first_air_date":"2025-05-09","genres":[{"id":35,"name":"Comedy"}],"homepage":"","id":287877,"in_production":true,"languages":["de"],"last_air_date":"2025-06-27","last_episode_to_air":{"id":6218896,"name":"Episode 8","overview":"","vote_average":0.0,"vote_count":0,"air_date":"2025-06-27","episode_number":8,"episode_type":"standard","production_code":"","runtime":29,"season_number":1,"show_id":287877,"still_path":null},"name":"Drunter & Drüber - Chaos auf dem Friedhof","next_episode_to_air":null,"networks":[{"id":189,"logo_path":"/k1poBlW9HGDnIyZU67BtH3BXQuz.png","name":"ORF 1","origin_country":"AT"},{"id":1024,"logo_path":"/w7HfLNm9CWwRmAMU58udl2L7We7.png","name":"Prime Video","origin_country":""}],"number_of_episodes":8,"number_of_seasons":1,"origin_country":["AT"],"original_language":"de","original_name":"Drunter & Drüber - Chaos auf dem Friedhof","overview":"When a rotten gravestone kills the cemetery manager, his deputy Butz Bohrlich already sees himself as the new number one at Donnerscheidt Cemetery. However, the ambitious man is ignored and the new boss Ursula Fink is put in front of him.","popularity":1.5083,"poster_path":"/kIS1dc4PhVA9qDYIkPLytqzKUSh.jpg","production_companies":[{"id":220619,"logo_path":"/5g2txBSd5ZvRcwKNKy99RX00JYc.png","name":"RUNDFILM","origin_country":"AT"}],"production_countries":[{"iso_3166_1":"AT","name":"Austria"}],"seasons":[{"air_date":"2025-05-09","episode_count":8,"id":449135,"name":"Season 1","overview":"","poster_path":"/kIS1dc4PhVA9qDYIkPLytqzKUSh.jpg","season_number":1,"vote_average":0.0}],"spoken_languages":[{"english_name":"German","iso_639_1":"de","name":"Deutsch"}],"status":"Returning Series","tagline":"","type":"Scripted","vote_average":6.0,"vote_count":7}
|
||||
12
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalfilmaour-fault-2025-me-titra-shqip
generated
Normal file
12
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalfilmaour-fault-2025-me-titra-shqip
generated
Normal file
File diff suppressed because one or more lines are too long
7
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalsCulpapercent20nuestrapercent202025
generated
Normal file
7
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalsCulpapercent20nuestrapercent202025
generated
Normal file
File diff suppressed because one or more lines are too long
7
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalsOurpercent20Faultpercent202025
generated
Normal file
7
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalsOurpercent20Faultpercent202025
generated
Normal file
File diff suppressed because one or more lines are too long
1
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalwp-jsondooplayerv2161211movie1
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalwp-jsondooplayerv2161211movie1
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"embed_url":"https:\/\/chuckle-tube.com\/e\/ysnreh6xejac","type":"iframe"}
|
||||
1
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalwp-jsondooplayerv2161211movie2
generated
Normal file
1
src/source/__fixtures__/Kokoshka/https:kokoshka.digitalwp-jsondooplayerv2161211movie2
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"embed_url":"https:\/\/dsvplay.com\/e\/3o4cg2dr81nn","type":"iframe"}
|
||||
|
|
@ -90,3 +90,28 @@ exports[`Kokoshka handle non-existent Steve 2025 1`] = `[]`;
|
|||
exports[`Kokoshka handle non-existent content gracefully 1`] = `[]`;
|
||||
|
||||
exports[`Kokoshka handle non-existent episode gracefully 1`] = `[]`;
|
||||
|
||||
exports[`Kokoshka handle our fault 2025 1`] = `
|
||||
[
|
||||
{
|
||||
"meta": {
|
||||
"countryCodes": [
|
||||
"al",
|
||||
],
|
||||
"referer": "https://kokoshka.digital/filma/our-fault-2025-me-titra-shqip/",
|
||||
"title": "Our Fault (2025) me Titra Shqip - Kokoshka.Digital | Filma Me Titra Shqip",
|
||||
},
|
||||
"url": "https://chuckle-tube.com/e/ysnreh6xejac",
|
||||
},
|
||||
{
|
||||
"meta": {
|
||||
"countryCodes": [
|
||||
"al",
|
||||
],
|
||||
"referer": "https://kokoshka.digital/filma/our-fault-2025-me-titra-shqip/",
|
||||
"title": "Our Fault (2025) me Titra Shqip - Kokoshka.Digital | Filma Me Titra Shqip",
|
||||
},
|
||||
"url": "https://dsvplay.com/e/3o4cg2dr81nn",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue