From 659733a9f73b9573b783c3dd9bc7fe1029cfbbe9 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Thu, 20 Feb 2025 08:36:48 -0700 Subject: [PATCH] go back to proxied fetcher with refer --- src/providers/sources/vidsrcsu.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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;