mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 17:53:24 +00:00
Handle episode not found
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { load } from 'cheerio';
|
import { load } from 'cheerio';
|
||||||
|
|
||||||
import type { ScrapeContext } from '@/utils/context';
|
import type { ScrapeContext } from '@/utils/context';
|
||||||
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
|
||||||
import { embedProviders, kissasianBase } from './common';
|
import { embedProviders, kissasianBase } from './common';
|
||||||
|
|
||||||
@@ -8,11 +9,12 @@ export async function getEmbeds(
|
|||||||
ctx: ScrapeContext,
|
ctx: ScrapeContext,
|
||||||
targetEpisode: {
|
targetEpisode: {
|
||||||
number: string;
|
number: string;
|
||||||
url: string;
|
url?: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
let embeds = await Promise.all(
|
let embeds = await Promise.all(
|
||||||
embedProviders.map(async (provider) => {
|
embedProviders.map(async (provider) => {
|
||||||
|
if (!targetEpisode.url) throw new NotFoundError('Episode not found');
|
||||||
const watch = await ctx.proxiedFetcher<any>(targetEpisode.url, {
|
const watch = await ctx.proxiedFetcher<any>(targetEpisode.url, {
|
||||||
baseUrl: kissasianBase,
|
baseUrl: kissasianBase,
|
||||||
query: {
|
query: {
|
||||||
|
Reference in New Issue
Block a user