diff --git a/src/providers/sources/vidsrcsu.ts b/src/providers/sources/vidsrcsu.ts index f99a816..945b888 100644 --- a/src/providers/sources/vidsrcsu.ts +++ b/src/providers/sources/vidsrcsu.ts @@ -3,10 +3,22 @@ import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; import { NotFoundError } from '@/utils/errors'; +const getHost = () => { + const urlObj = new URL(window.location.href); + return `${urlObj.protocol}//${urlObj.host}`; +}; + async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise { - const embedPage = await ctx.fetcher( + const embedPage = await ctx.proxiedFetcher( `https://vidsrc.su/embed/${ctx.media.type === 'movie' ? `movie/${ctx.media.tmdbId}` : `tv/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`}`, + { + headers: { + Referer: getHost(), + }, + }, ); + // eslint-disable-next-line no-console + console.log('host', getHost()); const decodedPeterMatch = embedPage.match(/decodeURIComponent\('([^']+)'\)/); const decodedPeterUrl = decodedPeterMatch ? decodeURIComponent(decodedPeterMatch[1]) : null;