From f8a6fa60aa6c1504f41d324c5d88831e22019048 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Thu, 6 Mar 2025 22:31:25 -0700 Subject: [PATCH] add vidapi.click source --- src/providers/all.ts | 2 ++ src/providers/sources/autoembed.ts | 3 ++ src/providers/sources/vidapiclick.ts | 50 ++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 src/providers/sources/vidapiclick.ts diff --git a/src/providers/all.ts b/src/providers/all.ts index de7eb58..b376019 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -97,6 +97,7 @@ import { slidemoviesScraper } from './sources/slidemovies'; import { smashyStreamScraper } from './sources/smashystream'; import { soaperTvScraper } from './sources/soapertv'; import { uiraliveScraper } from './sources/uiralive'; +import { vidapiClickScraper } from './sources/vidapiclick'; import { vidlinkScraper } from './sources/vidlink'; import { vidSrcToScraper } from './sources/vidsrcto'; import { warezcdnScraper } from './sources/warezcdn'; @@ -146,6 +147,7 @@ export function gatherAllSources(): Array { iosmirrorScraper, iosmirrorPVScraper, uiraliveScraper, + vidapiClickScraper, ]; } diff --git a/src/providers/sources/autoembed.ts b/src/providers/sources/autoembed.ts index 234c26c..c5172d7 100644 --- a/src/providers/sources/autoembed.ts +++ b/src/providers/sources/autoembed.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { flags } from '@/entrypoint/utils/targets'; import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base'; import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; @@ -25,6 +26,8 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis }, }); + console.log(data); + if (!data) throw new NotFoundError('Failed to fetch video source'); if (!data.videoSource) throw new NotFoundError('No video source found'); ctx.progress(50); diff --git a/src/providers/sources/vidapiclick.ts b/src/providers/sources/vidapiclick.ts new file mode 100644 index 0000000..48cb2aa --- /dev/null +++ b/src/providers/sources/vidapiclick.ts @@ -0,0 +1,50 @@ +/* eslint-disable no-console */ +import { flags } from '@/entrypoint/utils/targets'; +import { SourcererOutput, makeSourcerer } from '@/providers/base'; +import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context'; +import { NotFoundError } from '@/utils/errors'; + +const baseUrl = 'https://vidapi.click'; + +async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise { + const apiUrl = + ctx.media.type === 'show' + ? `${baseUrl}/api/video/tv/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}` + : `${baseUrl}/api/video/movie/${ctx.media.tmdbId}`; + + const apiRes = await ctx.proxiedFetcher(apiUrl, { + headers: { + 'User-Agent': + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', + }, + }); + + if (!apiRes) throw new NotFoundError('Failed to fetch video source'); + if (!apiRes.sources[0].file) throw new NotFoundError('No video source found'); + ctx.progress(50); + + ctx.progress(90); + + return { + embeds: [], + stream: [ + { + id: 'primary', + type: 'hls', + playlist: apiRes.sources[0].file, + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; +} + +export const vidapiClickScraper = makeSourcerer({ + id: 'vidapi-click', + name: 'vidapi.click', + rank: 89, + disabled: false, + flags: [flags.CORS_ALLOWED], + scrapeMovie: comboScraper, + scrapeShow: comboScraper, +});