mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-13 10:41:35 +00:00
add psvl
This commit is contained in:
parent
d9cff5023e
commit
f58438ba57
2 changed files with 66 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ import { primewireScraper } from './sources/primewire';
|
|||
import { ridooMoviesScraper } from './sources/ridomovies';
|
||||
import { smashyStreamScraper } from './sources/smashystream';
|
||||
import { soaperTvScraper } from './sources/soapertv';
|
||||
import { vidlinkScraper } from './sources/vidlink';
|
||||
import { vidSrcToScraper } from './sources/vidsrcto';
|
||||
import { warezcdnScraper } from './sources/warezcdn';
|
||||
import { webtorScraper } from './sources/webtor';
|
||||
|
|
@ -132,6 +133,7 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||
mp4hydraScraper,
|
||||
webtorScraper,
|
||||
embedsuScraper,
|
||||
vidlinkScraper,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
64
src/providers/sources/vidlink.ts
Normal file
64
src/providers/sources/vidlink.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/* eslint-disable no-console */
|
||||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { Caption, labelToLanguageCode } from '@/providers/captions';
|
||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { SourcererOutput, makeSourcerer } from '../base';
|
||||
|
||||
async function comboScraper(ctx: MovieScrapeContext | ShowScrapeContext): Promise<SourcererOutput> {
|
||||
const embedUrl =
|
||||
ctx.media.type === 'movie'
|
||||
? `https://vidlink.pro/movie/${ctx.media.tmdbId}`
|
||||
: `https://vidlink.pro/tv/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`;
|
||||
|
||||
const apiResponse = await ctx.proxiedFetcher<{
|
||||
results: Array<{
|
||||
video_urls: string[];
|
||||
subtitles: Array<{ label: string; file: string }>;
|
||||
}>;
|
||||
}>('https://psvl.api.pstream.org/api/video-url', {
|
||||
query: { embedUrl },
|
||||
});
|
||||
|
||||
if (!apiResponse?.results?.length) throw new NotFoundError('No results found');
|
||||
const primaryResult = apiResponse.results[0];
|
||||
|
||||
if (!primaryResult.video_urls?.length) throw new NotFoundError('No video URLs found');
|
||||
|
||||
const captions: Caption[] = [];
|
||||
for (const sub of primaryResult.subtitles) {
|
||||
const language = labelToLanguageCode(sub.label.split('-')[0].trim());
|
||||
if (!language) continue;
|
||||
|
||||
captions.push({
|
||||
id: sub.file,
|
||||
url: sub.file,
|
||||
type: 'vtt',
|
||||
hasCorsRestrictions: false,
|
||||
language,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
playlist: primaryResult.video_urls[0],
|
||||
type: 'hls',
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
captions,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const vidlinkScraper = makeSourcerer({
|
||||
id: 'vidlink',
|
||||
name: 'PSVL',
|
||||
rank: 113,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
Loading…
Reference in a new issue