feat(source): fix Frembed domain and enable it for movies
This commit is contained in:
parent
b4d556399a
commit
a4e24722c2
5 changed files with 47 additions and 3 deletions
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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<SourceResult[]> {
|
||||
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 }));
|
||||
};
|
||||
}
|
||||
|
|
|
|||
1
src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb
generated
Normal file
1
src/source/__fixtures__/Frembed/https:frembed.topapifilmsid3176andidTypetmdb
generated
Normal file
|
|
@ -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}
|
||||
|
|
@ -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`] = `
|
||||
[
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue