diff --git a/src/handler/Frembed.test.ts b/src/handler/Frembed.test.ts index 147dca1..ce3c8ca 100644 --- a/src/handler/Frembed.test.ts +++ b/src/handler/Frembed.test.ts @@ -19,7 +19,7 @@ describe('Frembed', () => { }); test('handles non-existent series gracefully', async () => { - const streams = await handler.handle(ctx, 'series', 'tt12345678:1:1'); + const streams = await handler.handle(ctx, 'series', 'tt4352342:1:1'); expect(streams).toHaveLength(0); }); diff --git a/src/handler/Frembed.ts b/src/handler/Frembed.ts index ad28d5b..0eaa27f 100644 --- a/src/handler/Frembed.ts +++ b/src/handler/Frembed.ts @@ -1,6 +1,6 @@ import axios from 'axios'; import { Handler } from './types'; -import { parseImdbId, Fetcher } from '../utils'; +import { parseImdbId, Fetcher, getTmdbIdFromImdbId } from '../utils'; import { ExtractorRegistry } from '../extractor'; import { Context } from '../types'; @@ -26,9 +26,9 @@ export class Frembed implements Handler { return []; } - const imdbId = parseImdbId(id); + const tmdbId = await getTmdbIdFromImdbId(ctx, this.fetcher, parseImdbId(id)); - const response = await this.apiCall(ctx, new URL(`https://frembed.club/api/series?id=${imdbId.id}&sa=${imdbId.series}&epi=${imdbId.episode}&idType=imdb`)); + const response = await this.apiCall(ctx, new URL(`https://frembed.club/api/series?id=${tmdbId.id}&sa=${tmdbId.series}&epi=${tmdbId.episode}&idType=tmdb`)); if (!response) { return []; } @@ -39,7 +39,7 @@ export class Frembed implements Handler { for (const key in json) { if (key.startsWith('link')) { try { - urls.push(new URL(json[key])); + urls.push(new URL(json[key].trim())); } catch { // Skip invalid URL } diff --git a/src/utils/__fixtures__/Fetcher/https:api.themoviedb.org3findtt4352342external_sourceimdb_id b/src/utils/__fixtures__/Fetcher/https:api.themoviedb.org3findtt4352342external_sourceimdb_id new file mode 100644 index 0000000..6feff22 --- /dev/null +++ b/src/utils/__fixtures__/Fetcher/https:api.themoviedb.org3findtt4352342external_sourceimdb_id @@ -0,0 +1 @@ +{"movie_results":[],"person_results":[],"tv_results":[{"backdrop_path":"/uYgcyrinlFfXTFkflzkOjAmtlpP.jpg","id":61945,"name":"Suburbia - Women on the Edge","original_name":"Vorstadtweiber","overview":"Vienna suburb. Better society. Appearance and reality. A golden cage. But is everything that glitters really gold? Actually, the five \"suburban women\" of the title couldn't be doing any better in their supposedly perfect, affluent world – could they?","poster_path":"/um3A1r8A5Cuco7ldJHKtMhU7zU9.jpg","media_type":"tv","adult":false,"original_language":"de","genre_ids":[35,18],"popularity":12.114,"first_air_date":"2015-01-12","vote_average":8.167,"vote_count":12,"origin_country":["AT"]}],"tv_episode_results":[],"tv_season_results":[]} \ No newline at end of file diff --git a/src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesidtt2085059andsa4andepi2andidTypeimdb b/src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesid42009andsa4andepi2andidTypetmdb similarity index 83% rename from src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesidtt2085059andsa4andepi2andidTypeimdb rename to src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesid42009andsa4andepi2andidTypetmdb index 9104055..ad55326 100644 --- a/src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesidtt2085059andsa4andepi2andidTypeimdb +++ b/src/utils/__fixtures__/Fetcher/https:frembed.clubapiseriesid42009andsa4andepi2andidTypetmdb @@ -1 +1 @@ -{"id":44334,"tmdb":"42009","title":"Black Mirror","sa":4,"epi":2,"link":"https://ahvsh.com/e/83izf7qzwpae,https://netu.frembed.fun/e/0DFgfkcXOsDP,https://likessb.com/e/7yjgl1x56n08.html,https://ds2play.com/e/fzfvfq3ngig0","imdb":"tt2085059","year":null,"version":"VF","link_vostfr":"","link1":"https://do7go.com/e/dfx8me4un4ul\t","link2":"https://netu.frembed.art/e/0DFgfkcXOsDP","link3":"https://johnalwayssame.com/e/cqy9oue7sv0g\t","link4":"https://ds2play.com/e/fzfvfq3ngig0","link5":null,"link6":null,"link7":null,"link1vostfr":"","link2vostfr":null,"link3vostfr":null,"link4vostfr":null,"link5vostfr":null,"link6vostfr":null,"link7vostfr":null,"link1vo":null,"link2vo":null,"link3vo":null,"link4vo":null,"link5vo":null,"link6vo":null,"link7vo":null,"date_creation":"2023-08-17T04:06:31.000Z","update_date":"2025-04-22T23:59:01.000Z","views":1,"tatavid":"https://tatavid.com/embed-d5qb488pe53n.html","backdropImage":"/dg3OindVAGZBjlT3xYKqIAdukPL.jpg","posterImage":"/seN6rRfN0I6n8iDXjlSMk1QjNcq.jpg","prevEpisode":{"sa":4,"epi":1,"url":"/series?id=tt2085059&sa=4&epi=1"},"nextEpisode":{"sa":4,"epi":3,"url":"/series?id=tt2085059&sa=4&epi=3"}} \ No newline at end of file +{"id":44334,"tmdb":"42009","title":"Black Mirror","sa":4,"epi":2,"link":"https://ahvsh.com/e/83izf7qzwpae,https://netu.frembed.fun/e/0DFgfkcXOsDP,https://likessb.com/e/7yjgl1x56n08.html,https://ds2play.com/e/fzfvfq3ngig0","imdb":"tt2085059","year":null,"version":"VF","link_vostfr":"","link1":"https://do7go.com/e/dfx8me4un4ul\t","link2":"https://netu.frembed.art/e/0DFgfkcXOsDP","link3":"https://johnalwayssame.com/e/cqy9oue7sv0g\t","link4":"https://ds2play.com/e/fzfvfq3ngig0","link5":null,"link6":null,"link7":null,"link1vostfr":"","link2vostfr":null,"link3vostfr":null,"link4vostfr":null,"link5vostfr":null,"link6vostfr":null,"link7vostfr":null,"link1vo":null,"link2vo":null,"link3vo":null,"link4vo":null,"link5vo":null,"link6vo":null,"link7vo":null,"date_creation":"2023-08-17T04:06:31.000Z","update_date":"2025-04-22T23:59:01.000Z","views":7,"tatavid":"https://tatavid.com/embed-d5qb488pe53n.html","backdropImage":"/dg3OindVAGZBjlT3xYKqIAdukPL.jpg","posterImage":"/seN6rRfN0I6n8iDXjlSMk1QjNcq.jpg","prevEpisode":{"sa":4,"epi":1,"url":"/series?id=42009&sa=4&epi=1"},"nextEpisode":{"sa":4,"epi":3,"url":"/series?id=42009&sa=4&epi=3"}} \ No newline at end of file