From a4e24722c222ce68fd237587ccb63f334cd0343b Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sun, 13 Jul 2025 18:43:49 +0000 Subject: [PATCH] feat(source): fix Frembed domain and enable it for movies --- src/source/Frembed.test.ts | 5 ++++ src/source/Frembed.ts | 14 +++++++-- ...tps:frembed.topapifilmsid3176andidTypetmdb | 1 + ...piseriesid42009andsa4andepi2andidTypetmdb} | 0 src/source/__snapshots__/Frembed.test.ts.snap | 30 +++++++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb rename src/source/__fixtures__/Frembed/{https:frembed.wikiapiseriesid42009andsa4andepi2andidTypetmdb => https:frembed.topapiseriesid42009andsa4andepi2andidTypetmdb} (100%) diff --git a/src/source/Frembed.test.ts b/src/source/Frembed.test.ts index 8cc092e..2e8e981 100644 --- a/src/source/Frembed.test.ts +++ b/src/source/Frembed.test.ts @@ -20,4 +20,9 @@ describe('Frembed', () => { const streams = await handler.handle(ctx, 'series', new TmdbId(42009, 4, 2)); expect(streams).toMatchSnapshot(); }); + + test('handle battle royal', async () => { + const streams = await handler.handle(ctx, 'movie', new TmdbId(3176, undefined, undefined)); + expect(streams).toMatchSnapshot(); + }); }); diff --git a/src/source/Frembed.ts b/src/source/Frembed.ts index a3490bc..4cadd5b 100644 --- a/src/source/Frembed.ts +++ b/src/source/Frembed.ts @@ -8,10 +8,12 @@ export class Frembed implements Source { public readonly label = 'Frembed'; - public readonly contentTypes: ContentType[] = ['series']; + public readonly contentTypes: ContentType[] = ['movie', 'series']; public readonly countryCodes: CountryCode[] = [CountryCode.fr]; + private readonly baseUrl = 'https://frembed.top'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -21,7 +23,9 @@ export class Frembed implements Source { public async handle(ctx: Context, _type: string, id: Id): Promise { const tmdbId = await getTmdbId(ctx, this.fetcher, id); - const apiUrl = new URL(`https://frembed.wiki/api/series?id=${tmdbId.id}&sa=${tmdbId.season}&epi=${tmdbId.episode}&idType=tmdb`); + const apiUrl = tmdbId.season + ? new URL(`/api/series?id=${tmdbId.id}&sa=${tmdbId.season}&epi=${tmdbId.episode}&idType=tmdb`, this.baseUrl) + : new URL(`/api/films?id=${tmdbId.id}&idType=tmdb`, this.baseUrl); const json = JSON.parse(await this.fetcher.text(ctx, apiUrl)); @@ -36,6 +40,10 @@ export class Frembed implements Source { } } - return urls.map(url => ({ countryCode: CountryCode.fr, title: `${json['title']} ${tmdbId.season}x${tmdbId.episode}`, url })); + const title = tmdbId.season + ? `${json['title']} ${tmdbId.season}x${tmdbId.episode}` + : json['title']; + + return urls.map(url => ({ countryCode: CountryCode.fr, title, url })); }; } diff --git a/src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb b/src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb new file mode 100644 index 0000000..904e4b9 --- /dev/null +++ b/src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb @@ -0,0 +1 @@ +{"tmdb":"3176","title":"Battle Royale","link1":"https://do7go.com/e/gtenfs0rffzq","link2":"https://netu.fanstream.live/e/p0QUHavRbQD0","link3":"https://jilliandescribecompany.com/e/lbeqm6ofmauq","link4":"https://video.streamtales.cc/player/frvod.php?url=https://streamtales.cc:8443/videos/3176.mp4","link5":null,"link6":"","link7":"https://uqload.cx/embed-pnxmokgrigu9.html","link1vostfr":null,"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,"imdb":"tt0266308","year":"2000","version":"TrueFrench","quality":"HD","qualityVostfr":null,"qualityVo":null,"poster":"/8PzexNbQ9eAKxe0p2U4XP3DVJCp.jpg","backdrop":"/pmRtI4QvcBvXjw9mLOEAsV9Bq7i.jpg,/amBvmIshdsSkOtvVIgxl7YSQ9Dg.jpg,/n4rNQUV9S9DMgCkQVt7R7VLYxNr.jpg,/55qVIFhykb6M6CGWRKQd9BsLI5D.jpg,/e9vJTJHkCOyBitE67n8zlp5Qm8q.jpg,/tSbZky1KLzqOSGPzYtqnxTQzNFy.jpg,/cQR3VHRMUL8xGkWK5Up8rI7DHQD.jpg,/4oIoe9tcSRzGSImp9Jqp1SKFwes.jpg,/zajlFkhKugj9tqH57KHXpmTXIku.jpg,/hpP0ELkViFlU8PVWbEBvVx12YtJ.jpg","checked":null,"dead_link":0,"views":"7","date_creation":"2023-08-17T04:06:45.000Z","update_date":"2024-09-19T01:28:34.000Z","original_title":"バトル・ロワイアル","title_vf":"Battle Royale","tatavid":"https://tatavid.com/embed-ykd2objlb8ru.html","dcsutom":96950} \ No newline at end of file diff --git a/src/source/__fixtures__/Frembed/https:frembed.wikiapiseriesid42009andsa4andepi2andidTypetmdb b/src/source/__fixtures__/Frembed/https:frembed.topapiseriesid42009andsa4andepi2andidTypetmdb similarity index 100% rename from src/source/__fixtures__/Frembed/https:frembed.wikiapiseriesid42009andsa4andepi2andidTypetmdb rename to src/source/__fixtures__/Frembed/https:frembed.topapiseriesid42009andsa4andepi2andidTypetmdb diff --git a/src/source/__snapshots__/Frembed.test.ts.snap b/src/source/__snapshots__/Frembed.test.ts.snap index 3203c13..b2159ed 100644 --- a/src/source/__snapshots__/Frembed.test.ts.snap +++ b/src/source/__snapshots__/Frembed.test.ts.snap @@ -1,5 +1,35 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`Frembed handle battle royal 1`] = ` +[ + { + "countryCode": "fr", + "title": "Battle Royale", + "url": "https://do7go.com/e/gtenfs0rffzq", + }, + { + "countryCode": "fr", + "title": "Battle Royale", + "url": "https://netu.fanstream.live/e/p0QUHavRbQD0", + }, + { + "countryCode": "fr", + "title": "Battle Royale", + "url": "https://jilliandescribecompany.com/e/lbeqm6ofmauq", + }, + { + "countryCode": "fr", + "title": "Battle Royale", + "url": "https://video.streamtales.cc/player/frvod.php?url=https://streamtales.cc:8443/videos/3176.mp4", + }, + { + "countryCode": "fr", + "title": "Battle Royale", + "url": "https://uqload.cx/embed-pnxmokgrigu9.html", + }, +] +`; + exports[`Frembed handle imdb black mirror s4e2 1`] = ` [ {