Fix soaperTv

This commit is contained in:
TPN 2024-08-04 17:42:10 +00:00
parent 9c7bc36ab1
commit 78d3dbd4e8

View file

@ -1,9 +1,11 @@
import { load } from 'cheerio'; import { load } from 'cheerio';
import { flags } from '@/entrypoint/utils/targets';
import { Caption, labelToLanguageCode } from '@/providers/captions'; import { Caption, labelToLanguageCode } from '@/providers/captions';
import { Stream } from '@/providers/streams'; import { Stream } from '@/providers/streams';
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
import { NotFoundError } from '@/utils/errors'; import { NotFoundError } from '@/utils/errors';
import { convertPlaylistsToDataUrls } from '@/utils/playlist';
import { InfoResponse } from './types'; import { InfoResponse } from './types';
import { SourcererOutput, makeSourcerer } from '../../base'; import { SourcererOutput, makeSourcerer } from '../../base';
@ -88,20 +90,20 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext): Pr
stream: [ stream: [
{ {
id: 'primary', id: 'primary',
playlist: `${baseUrl}/${streamResJson.val}`, playlist: await convertPlaylistsToDataUrls(ctx.proxiedFetcher, `${baseUrl}/${streamResJson.val}`),
type: 'hls', type: 'hls',
proxyDepth: 2, proxyDepth: 2,
flags: [], flags: [flags.CORS_ALLOWED],
captions, captions,
}, },
...(streamResJson.val_bak ...(streamResJson.val_bak
? [ ? [
{ {
id: 'backup', id: 'backup',
playlist: `${baseUrl}/${streamResJson.val_bak}`, playlist: await convertPlaylistsToDataUrls(ctx.proxiedFetcher, `${baseUrl}/${streamResJson.val_bak}`),
type: 'hls', type: 'hls',
flags: [flags.CORS_ALLOWED],
proxyDepth: 2, proxyDepth: 2,
flags: [],
captions, captions,
} as Stream, } as Stream,
] ]
@ -114,7 +116,7 @@ export const soaperTvScraper = makeSourcerer({
id: 'soapertv', id: 'soapertv',
name: 'SoaperTV', name: 'SoaperTV',
rank: 126, rank: 126,
flags: [], flags: [flags.CORS_ALLOWED],
scrapeMovie: universalScraper, scrapeMovie: universalScraper,
scrapeShow: universalScraper, scrapeShow: universalScraper,
}); });