mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 14:53:24 +00:00
Add requested changes
This commit is contained in:
@@ -9,10 +9,9 @@ import { NotFoundError } from '@/utils/errors';
|
|||||||
import { SearchResults } from './types';
|
import { SearchResults } from './types';
|
||||||
|
|
||||||
const nepuBase = 'https://nepu.to';
|
const nepuBase = 'https://nepu.to';
|
||||||
const nepuReferer = `${nepuBase}/`;
|
|
||||||
|
|
||||||
const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => {
|
const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => {
|
||||||
const searchResultRequest = await ctx.proxiedFetcher('/ajax/posts', {
|
const searchResultRequest = await ctx.proxiedFetcher<string>('/ajax/posts', {
|
||||||
baseUrl: nepuBase,
|
baseUrl: nepuBase,
|
||||||
query: {
|
query: {
|
||||||
q: ctx.media.title,
|
q: ctx.media.title,
|
||||||
@@ -38,7 +37,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
|
|||||||
videoUrl = `${show.url}/season/${ctx.media.season.number}/episode/${ctx.media.episode.number}`;
|
videoUrl = `${show.url}/season/${ctx.media.season.number}/episode/${ctx.media.episode.number}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const videoPage = await ctx.proxiedFetcher(videoUrl, {
|
const videoPage = await ctx.proxiedFetcher<string>(videoUrl, {
|
||||||
baseUrl: nepuBase,
|
baseUrl: nepuBase,
|
||||||
});
|
});
|
||||||
const videoPage$ = load(videoPage);
|
const videoPage$ = load(videoPage);
|
||||||
@@ -46,13 +45,10 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
|
|||||||
|
|
||||||
if (!embedId) throw new NotFoundError('No embed found.');
|
if (!embedId) throw new NotFoundError('No embed found.');
|
||||||
|
|
||||||
const playerPage = await ctx.proxiedFetcher('/ajax/embed', {
|
const playerPage = await ctx.proxiedFetcher<string>('/ajax/embed', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
baseUrl: nepuBase,
|
baseUrl: nepuBase,
|
||||||
headers: {
|
body: new URLSearchParams({ id: embedId }),
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: `id=${embedId}`,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const streamUrl = playerPage.match(/"file":"(http[^"]+)"/);
|
const streamUrl = playerPage.match(/"file":"(http[^"]+)"/);
|
||||||
@@ -68,10 +64,6 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
|
|||||||
playlist: streamUrl[1],
|
playlist: streamUrl[1],
|
||||||
type: 'hls',
|
type: 'hls',
|
||||||
flags: [flags.CORS_ALLOWED],
|
flags: [flags.CORS_ALLOWED],
|
||||||
preferredHeaders: {
|
|
||||||
Origin: nepuBase,
|
|
||||||
Referer: nepuReferer,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
} as SourcererOutput;
|
} as SourcererOutput;
|
||||||
|
Reference in New Issue
Block a user