diff --git a/src/source/CineHDPlus.ts b/src/source/CineHDPlus.ts index 75f3420..f301942 100644 --- a/src/source/CineHDPlus.ts +++ b/src/source/CineHDPlus.ts @@ -13,6 +13,8 @@ export class CineHDPlus implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; + public readonly baseUrl = 'https://cinehdplus.cam'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -50,7 +52,7 @@ export class CineHDPlus implements Source { }; private fetchSeriesPageUrl = async (ctx: Context, imdbId: ImdbId): Promise => { - const html = await this.fetcher.text(ctx, new URL(`https://cinehdplus.cam/series/?story=${imdbId.id}&do=search&subaction=search`)); + const html = await this.fetcher.text(ctx, new URL(`/series/?story=${imdbId.id}&do=search&subaction=search`, this.baseUrl)); const $ = cheerio.load(html); diff --git a/src/source/Cuevana.ts b/src/source/Cuevana.ts index 1d32730..d398ec1 100644 --- a/src/source/Cuevana.ts +++ b/src/source/Cuevana.ts @@ -13,6 +13,8 @@ export class Cuevana implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; + public readonly baseUrl = 'https://ww1.cuevana3.is'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -86,7 +88,7 @@ export class Cuevana implements Source { }; private async fetchPageUrl(ctx: Context, keyword: string): Promise { - const searchUrl = new URL(`https://ww1.cuevana3.is/search/${encodeURIComponent(keyword)}/`); + const searchUrl = new URL(`/search/${encodeURIComponent(keyword)}/`, this.baseUrl); const html = await this.fetcher.text(ctx, searchUrl, { headers: { Referer: searchUrl.origin } }); const $ = cheerio.load(html); diff --git a/src/source/Eurostreaming.ts b/src/source/Eurostreaming.ts index b88d27d..6f1149c 100644 --- a/src/source/Eurostreaming.ts +++ b/src/source/Eurostreaming.ts @@ -13,7 +13,7 @@ export class Eurostreaming implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.it]; - private readonly baseUrl = 'https://eurostreaming.luxe'; + public readonly baseUrl = 'https://eurostreaming.luxe'; private readonly fetcher: Fetcher; diff --git a/src/source/Frembed.ts b/src/source/Frembed.ts index 4cadd5b..c2a91d8 100644 --- a/src/source/Frembed.ts +++ b/src/source/Frembed.ts @@ -12,7 +12,7 @@ export class Frembed implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.fr]; - private readonly baseUrl = 'https://frembed.top'; + public readonly baseUrl = 'https://frembed.top'; private readonly fetcher: Fetcher; diff --git a/src/source/FrenchCloud.ts b/src/source/FrenchCloud.ts index b8ed6df..db20e40 100644 --- a/src/source/FrenchCloud.ts +++ b/src/source/FrenchCloud.ts @@ -13,6 +13,8 @@ export class FrenchCloud implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.fr]; + public readonly baseUrl = 'https://frenchcloud.cam'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -22,7 +24,7 @@ export class FrenchCloud implements Source { public async handle(ctx: Context, _type: string, id: Id): Promise { const imdbId = await getImdbId(ctx, this.fetcher, id); - const pageUrl = new URL(`https://frenchcloud.cam/movie/${imdbId.id}`); + const pageUrl = new URL(`/movie/${imdbId.id}`, this.baseUrl); const html = await this.fetcher.text(ctx, pageUrl); const $ = cheerio.load(html); diff --git a/src/source/HomeCine.ts b/src/source/HomeCine.ts index 6518236..a72ab48 100644 --- a/src/source/HomeCine.ts +++ b/src/source/HomeCine.ts @@ -13,7 +13,7 @@ export class HomeCine implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; - private readonly baseUrl = 'https://www3.homecine.to'; + public readonly baseUrl = 'https://www3.homecine.to'; private readonly fetcher: Fetcher; diff --git a/src/source/KinoGer.ts b/src/source/KinoGer.ts index a9bdcdd..c69e13b 100644 --- a/src/source/KinoGer.ts +++ b/src/source/KinoGer.ts @@ -13,7 +13,7 @@ export class KinoGer implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.de]; - private readonly baseUrl = 'https://kinoger.com'; + public readonly baseUrl = 'https://kinoger.com'; private readonly fetcher: Fetcher; diff --git a/src/source/MegaKino.ts b/src/source/MegaKino.ts index c6c6421..f8bb933 100644 --- a/src/source/MegaKino.ts +++ b/src/source/MegaKino.ts @@ -13,6 +13,8 @@ export class MegaKino implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly baseUrl = 'https://megakino.si'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -42,7 +44,7 @@ export class MegaKino implements Source { }; private fetchPageUrl = async (ctx: Context, imdbId: ImdbId): Promise => { - const html = await this.fetcher.text(ctx, new URL(`https://megakino.si/?do=search&subaction=search&story=${imdbId.id}`)); + const html = await this.fetcher.text(ctx, new URL(`/?do=search&subaction=search&story=${imdbId.id}`, this.baseUrl)); const $ = cheerio.load(html); diff --git a/src/source/MeineCloud.ts b/src/source/MeineCloud.ts index 614d42e..f77c857 100644 --- a/src/source/MeineCloud.ts +++ b/src/source/MeineCloud.ts @@ -13,6 +13,8 @@ export class MeineCloud implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly baseUrl = 'https://meinecloud.click'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -22,7 +24,7 @@ export class MeineCloud implements Source { public async handle(ctx: Context, _type: string, id: Id): Promise { const imdbId = await getImdbId(ctx, this.fetcher, id); - const pageUrl = new URL(`https://meinecloud.click/movie/${imdbId.id}`); + const pageUrl = new URL(`/movie/${imdbId.id}`, this.baseUrl); const html = await this.fetcher.text(ctx, pageUrl); const $ = cheerio.load(html); diff --git a/src/source/MostraGuarda.ts b/src/source/MostraGuarda.ts index 8c1488e..f64f9fa 100644 --- a/src/source/MostraGuarda.ts +++ b/src/source/MostraGuarda.ts @@ -13,6 +13,8 @@ export class MostraGuarda implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.it]; + public readonly baseUrl = 'https://mostraguarda.stream'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -22,7 +24,7 @@ export class MostraGuarda implements Source { public async handle(ctx: Context, _type: string, id: Id): Promise { const imdbId = await getImdbId(ctx, this.fetcher, id); - const pageUrl = new URL(`https://mostraguarda.stream/movie/${imdbId.id}`); + const pageUrl = new URL(`/movie/${imdbId.id}`, this.baseUrl); const html = await this.fetcher.text(ctx, pageUrl); const $ = cheerio.load(html); diff --git a/src/source/Movix.ts b/src/source/Movix.ts index 538d199..bf23772 100644 --- a/src/source/Movix.ts +++ b/src/source/Movix.ts @@ -16,7 +16,7 @@ export class Movix implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.fr]; - private readonly baseUrl = 'https://api.movix.site'; + public readonly baseUrl = 'https://api.movix.site'; private readonly fetcher: Fetcher; diff --git a/src/source/PrimeWire.ts b/src/source/PrimeWire.ts index fde3177..1218ae2 100644 --- a/src/source/PrimeWire.ts +++ b/src/source/PrimeWire.ts @@ -15,7 +15,7 @@ export class PrimeWire implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.en]; - private readonly baseUrl = 'https://www.primewire.tf'; + public readonly baseUrl = 'https://www.primewire.tf'; private readonly fetcher: Fetcher; diff --git a/src/source/Soaper.ts b/src/source/Soaper.ts index 394a1c0..45feab8 100644 --- a/src/source/Soaper.ts +++ b/src/source/Soaper.ts @@ -13,7 +13,7 @@ export class Soaper implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.en]; - private readonly baseUrl = 'https://soaper.live'; + public readonly baseUrl = 'https://soaper.live'; private readonly fetcher: Fetcher; diff --git a/src/source/StreamKiste.ts b/src/source/StreamKiste.ts index b75cfd5..cd84a45 100644 --- a/src/source/StreamKiste.ts +++ b/src/source/StreamKiste.ts @@ -13,6 +13,8 @@ export class StreamKiste implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly baseUrl = 'https://streamkiste.taxi'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -45,7 +47,7 @@ export class StreamKiste implements Source { }; private fetchSeriesPageUrl = async (ctx: Context, imdbId: ImdbId): Promise => { - const html = await this.fetcher.text(ctx, new URL(`https://streamkiste.taxi/?story=${imdbId.id}&do=search&subaction=search`)); + const html = await this.fetcher.text(ctx, new URL(`/?story=${imdbId.id}&do=search&subaction=search`, this.baseUrl)); const $ = cheerio.load(html); diff --git a/src/source/VerHdLink.ts b/src/source/VerHdLink.ts index b61f180..bdedc13 100644 --- a/src/source/VerHdLink.ts +++ b/src/source/VerHdLink.ts @@ -13,6 +13,8 @@ export class VerHdLink implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.es, CountryCode.mx]; + public readonly baseUrl = 'https://verhdlink.cam'; + private readonly fetcher: Fetcher; public constructor(fetcher: Fetcher) { @@ -22,7 +24,7 @@ export class VerHdLink implements Source { public async handle(ctx: Context, _type: string, id: Id): Promise { const imdbId = await getImdbId(ctx, this.fetcher, id); - const pageUrl = new URL(`https://verhdlink.cam/movie/${imdbId.id}`); + const pageUrl = new URL(`/movie/${imdbId.id}`, this.baseUrl); const html = await this.fetcher.text(ctx, pageUrl); const $ = cheerio.load(html); diff --git a/src/source/VidSrc.ts b/src/source/VidSrc.ts index 2026beb..046d833 100644 --- a/src/source/VidSrc.ts +++ b/src/source/VidSrc.ts @@ -12,7 +12,7 @@ export class VidSrc implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.en]; - private readonly baseUrl = 'https://vidsrc.xyz'; + public readonly baseUrl = 'https://vidsrc.xyz'; private readonly fetcher: Fetcher; diff --git a/src/source/VixSrc.ts b/src/source/VixSrc.ts index 824b997..5ab30a7 100644 --- a/src/source/VixSrc.ts +++ b/src/source/VixSrc.ts @@ -12,7 +12,7 @@ export class VixSrc implements Source { public readonly countryCodes: CountryCode[] = [CountryCode.multi, CountryCode.it]; - private readonly baseUrl = 'https://vixsrc.to'; + public readonly baseUrl = 'https://vixsrc.to'; private readonly fetcher: Fetcher; diff --git a/src/source/types.ts b/src/source/types.ts index ff01782..7f60699 100644 --- a/src/source/types.ts +++ b/src/source/types.ts @@ -17,5 +17,7 @@ export interface Source { readonly countryCodes: CountryCode[]; + readonly baseUrl: string; + handle(ctx: Context, type: ContentType, id: Id): Promise<(SourceResult[])>; } diff --git a/src/utils/StreamResolver.test.ts b/src/utils/StreamResolver.test.ts index 0248092..c1fd4fc 100644 --- a/src/utils/StreamResolver.test.ts +++ b/src/utils/StreamResolver.test.ts @@ -76,6 +76,8 @@ describe('resolve', () => { public readonly countryCodes: CountryCode[] = [CountryCode.de]; + public readonly baseUrl = 'https://example.com'; + public readonly handle = async (): Promise => { return [{ countryCode: CountryCode.de, url: new URL('https://example.com') }]; }; @@ -249,6 +251,7 @@ describe('resolve', () => { label: 'MockHandler', contentTypes: ['movie'], countryCodes: [CountryCode.de], + baseUrl: 'https://example.com', handle: jest.fn().mockRejectedValue(new NotFoundError()), }; const streamResolver = new StreamResolver(logger, new ExtractorRegistry(logger, createExtractors(fetcher)));