mirror of
https://github.com/p-stream/providers.git
synced 2026-03-11 17:55:36 +00:00
Create neputo.ts
This commit is contained in:
parent
1c08477d42
commit
7f3bf18141
1 changed files with 45 additions and 0 deletions
45
src/providers/sources/neputo.ts
Normal file
45
src/providers/sources/neputo.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
|
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||||
|
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
|
const nepuBase = 'https://nscrape.andresdev.org/api';
|
||||||
|
|
||||||
|
async function scrape(ctx: MovieScrapeContext | ShowScrapeContext): Promise<SourcererOutput> {
|
||||||
|
const tmdbId = ctx.media.tmdbId;
|
||||||
|
|
||||||
|
let url: string;
|
||||||
|
if (ctx.media.type === 'movie') {
|
||||||
|
url = `${nepuBase}/get-stream?tmdbId=${tmdbId}`;
|
||||||
|
} else {
|
||||||
|
url = `${nepuBase}/get-show-stream?tmdbId=${tmdbId}&season=${ctx.media.season.number}&episode=${ctx.media.episode.number}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await ctx.proxiedFetcher<any>(url);
|
||||||
|
|
||||||
|
if (!response.success || !response.rurl) {
|
||||||
|
throw new NotFoundError('No stream found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
stream: [
|
||||||
|
{
|
||||||
|
id: 'neputo',
|
||||||
|
type: 'hls',
|
||||||
|
playlist: response.rurl,
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
captions: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
embeds: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const nepuScraper = makeSourcerer({
|
||||||
|
id: 'neputo',
|
||||||
|
name: 'Nepu.to',
|
||||||
|
rank: 201,
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
scrapeMovie: scrape,
|
||||||
|
scrapeShow: scrape,
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue