mirror of
https://github.com/sussy-code/providers.git
synced 2026-04-18 23:22:09 +00:00
Update nsbx
This commit is contained in:
parent
c5727e7653
commit
5f643819a0
3 changed files with 18 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ function embed(provider: { id: string; rank: number }) {
|
|||
|
||||
const search = await ctx.fetcher.full('/search', {
|
||||
query: {
|
||||
query: encodeURIComponent(query),
|
||||
query,
|
||||
provider: provider.id,
|
||||
},
|
||||
credentials: 'include',
|
||||
|
|
@ -37,7 +37,7 @@ function embed(provider: { id: string; rank: number }) {
|
|||
|
||||
const result = await ctx.fetcher('/provider', {
|
||||
query: {
|
||||
resourceId: encodeURIComponent(search.body.url),
|
||||
resourceId: search.body.url,
|
||||
provider: provider.id,
|
||||
},
|
||||
credentials: 'include',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
|||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { whvxScraper } from './whvx';
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const query = {
|
||||
title: ctx.media.title,
|
||||
|
|
@ -21,13 +23,25 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
if (res.providers?.length === 0) throw new NotFoundError('No providers available');
|
||||
if (!res.endpoint) throw new Error('No endpoint returned');
|
||||
|
||||
const embeds = res.providers.map((provider: string) => {
|
||||
let embeds = res.providers.map((provider: string) => {
|
||||
return {
|
||||
embedId: provider,
|
||||
url: `${JSON.stringify(query)}|${res.endpoint}`,
|
||||
};
|
||||
});
|
||||
|
||||
try {
|
||||
const whvx =
|
||||
ctx.media.type === 'movie' && whvxScraper.scrapeMovie
|
||||
? await whvxScraper.scrapeMovie(ctx as MovieScrapeContext)
|
||||
: whvxScraper.scrapeShow
|
||||
? await whvxScraper.scrapeShow(ctx as ShowScrapeContext)
|
||||
: null;
|
||||
if (whvx && whvx.embeds.length) embeds = [...embeds, ...whvx.embeds];
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
|
||||
return {
|
||||
embeds,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export const whvxScraper = makeSourcerer({
|
|||
name: 'WHVX',
|
||||
rank: 149,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
disabled: false,
|
||||
disabled: true,
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue