mirror of
https://github.com/p-stream/providers.git
synced 2026-04-20 18:42:06 +00:00
Fix nsbx, now works with ext on all instances
This commit is contained in:
parent
30511f11e8
commit
ead928c5d0
2 changed files with 12 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { EmbedOutput, makeEmbed } from '@/providers/base';
|
||||
import { headers } from '@/providers/sources/nsbx';
|
||||
|
||||
export const deltaScraper = makeEmbed({
|
||||
id: 'delta',
|
||||
|
|
@ -7,7 +8,9 @@ export const deltaScraper = makeEmbed({
|
|||
disabled: false,
|
||||
async scrape(ctx) {
|
||||
const url = `https://api.nsbx.ru/provider?resourceId=${encodeURIComponent(ctx.url)}&provider=delta`;
|
||||
const result = await ctx.fetcher(url);
|
||||
const result = await ctx.fetcher(url, {
|
||||
headers,
|
||||
});
|
||||
|
||||
return result as EmbedOutput;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base
|
|||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
export const headers = {
|
||||
Origin: 'https://extension.works.again.with.nsbx',
|
||||
Referer: 'https://extension.works.again.with.nsbx',
|
||||
};
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const query = {
|
||||
title: ctx.media.title,
|
||||
|
|
@ -19,7 +24,9 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
query.episode = ctx.media.episode.number.toString();
|
||||
}
|
||||
|
||||
const result = await ctx.fetcher(`https://api.nsbx.ru/search?query=${encodeURIComponent(JSON.stringify(query))}`);
|
||||
const result = await ctx.fetcher(`https://api.nsbx.ru/search?query=${encodeURIComponent(JSON.stringify(query))}`, {
|
||||
headers,
|
||||
});
|
||||
|
||||
if (result.embeds.length === 0) throw new NotFoundError('No watchable item found');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue