mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-14 03:14:54 +00:00
go back to proxied fetcher with refer
This commit is contained in:
parent
2637d9294f
commit
659733a9f7
1 changed files with 13 additions and 1 deletions
|
|
@ -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<SourcererOutput> {
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue