From 1de8f8b583078323b0dfdd0d6728a40cd3a847d7 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Sat, 9 Aug 2025 12:57:47 -0600 Subject: [PATCH] simplify vidify --- src/providers/all.ts | 24 +- src/providers/embeds/vidify.ts | 493 +++------------------------------ 2 files changed, 48 insertions(+), 469 deletions(-) diff --git a/src/providers/all.ts b/src/providers/all.ts index 65d52b0..f295c6c 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -41,18 +41,7 @@ import { streamwishSpanishScraper, } from './embeds/streamwish'; import { vidCloudScraper } from './embeds/vidcloud'; -import { - vidifyAlfaEmbed, - vidifyBravoEmbed, - vidifyCharlieEmbed, - vidifyDeltaEmbed, - vidifyEchoEmbed, - vidifyFoxtrotEmbed, - vidifyGolfEmbed, - vidifyHotelEmbed, - vidifyIndiaEmbed, - vidifyJuliettEmbed, -} from './embeds/vidify'; +import { vidifyEmbeds } from './embeds/vidify'; import { VidsrcsuServer10Scraper, VidsrcsuServer11Scraper, @@ -183,16 +172,7 @@ export function gatherAllEmbeds(): Array { madplayNsapiEmbed, madplayRoperEmbed, madplayNsapiVidFastEmbed, - vidifyAlfaEmbed, - vidifyBravoEmbed, - vidifyCharlieEmbed, - vidifyDeltaEmbed, - vidifyEchoEmbed, - vidifyFoxtrotEmbed, - vidifyGolfEmbed, - vidifyHotelEmbed, - vidifyIndiaEmbed, - vidifyJuliettEmbed, + ...vidifyEmbeds, ...rivestreamEmbeds, ]; } diff --git a/src/providers/embeds/vidify.ts b/src/providers/embeds/vidify.ts index ceb084d..0070b99 100644 --- a/src/providers/embeds/vidify.ts +++ b/src/providers/embeds/vidify.ts @@ -5,6 +5,8 @@ import { createM3U8ProxyUrl } from '@/utils/proxy'; import { EmbedOutput, makeEmbed } from '../base'; +const VIDIFY_SERVERS = ['alfa', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india', 'juliett']; + // Do not do this. This is very lazy! const M3U8_URL_REGEX = /https?:\/\/[^\s"'<>]+?\.m3u8[^\s"'<>]*/i; @@ -63,457 +65,54 @@ const headers = { 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', }; -export const vidifyAlfaEmbed = makeEmbed({ - id: 'vidify-alfa', - name: 'Vidify Alfa', - rank: 230, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; +export function makeVidifyEmbed(id: string, rank: number = 100) { + const serverIndex = VIDIFY_SERVERS.indexOf(id) + 1; - let url = `https://${baseUrl}/`; + return makeEmbed({ + id: `vidify-${id}`, + name: `Vidify ${id.charAt(0).toUpperCase() + id.slice(1)}`, + rank, + async scrape(ctx): Promise { + const query = JSON.parse(ctx.url); + const { type, tmdbId, season, episode } = query; - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=1`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=1`; - } else { - throw new NotFoundError('Unsupported media type'); - } + let url = `https://${baseUrl}/`; - const res = await ctx.proxiedFetcher(url, { headers }); + if (type === 'movie') { + url += `/movie/${tmdbId}?sr=${serverIndex}`; + } else if (type === 'show') { + url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=${serverIndex}`; + } else { + throw new NotFoundError('Unsupported media type'); + } - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { + const res = await ctx.proxiedFetcher(url, { headers }); + + const playlistUrl = findFirstM3U8Url(res); + if (playlistUrl) { + if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { + throw new NotFoundError('No playlist URL found'); + } + } + if (!playlistUrl) { throw new NotFoundError('No playlist URL found'); } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyBravoEmbed = makeEmbed({ - id: 'vidify-bravo', - name: 'Vidify Bravo', - rank: 229, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=2`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=2`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyCharlieEmbed = makeEmbed({ - id: 'vidify-charlie', - name: 'Vidify Charlie', - rank: 228, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=3`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=3`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyDeltaEmbed = makeEmbed({ - id: 'vidify-delta', - name: 'Vidify Delta', - rank: 227, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=4`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=4`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyEchoEmbed = makeEmbed({ - id: 'vidify-echo', - name: 'Vidify Echo', - rank: 226, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=5`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=5`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyFoxtrotEmbed = makeEmbed({ - id: 'vidify-foxtrot', - name: 'Vidify Foxtrot', - rank: 225, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=6`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=6`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyGolfEmbed = makeEmbed({ - id: 'vidify-golf', - name: 'Vidify Golf', - rank: 224, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=7`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=7`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyHotelEmbed = makeEmbed({ - id: 'vidify-hotel', - name: 'Vidify Hotel', - rank: 223, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=8`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=8`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyIndiaEmbed = makeEmbed({ - id: 'vidify-india', - name: 'Vidify India', - rank: 222, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=9`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=9`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); - -export const vidifyJuliettEmbed = makeEmbed({ - id: 'vidify-juliett', - name: 'Vidify Juliett', - rank: 221, - async scrape(ctx): Promise { - const query = JSON.parse(ctx.url); - const { type, tmdbId, season, episode } = query; - - let url = `https://${baseUrl}/`; - - if (type === 'movie') { - url += `/movie/${tmdbId}?sr=10`; - } else if (type === 'show') { - url += `/tv/${tmdbId}/season/${season}/episode/${episode}?sr=10`; - } else { - throw new NotFoundError('Unsupported media type'); - } - - const res = await ctx.proxiedFetcher(url, { headers }); - - const playlistUrl = findFirstM3U8Url(res); - if (playlistUrl) { - if (playlistUrl.includes('https://live.adultiptv.net/rough.m3u8')) { - throw new NotFoundError('No playlist URL found'); - } - } - if (!playlistUrl) { - throw new NotFoundError('No playlist URL found'); - } - - ctx.progress(100); - - return { - stream: [ - { - id: 'primary', - type: 'hls', - playlist: createM3U8ProxyUrl(playlistUrl, headers), - flags: [flags.CORS_ALLOWED], - captions: [], - }, - ], - }; - }, -}); + ctx.progress(100); + + return { + stream: [ + { + id: 'primary', + type: 'hls', + playlist: createM3U8ProxyUrl(playlistUrl, headers), + flags: [flags.CORS_ALLOWED], + captions: [], + }, + ], + }; + }, + }); +} + +export const vidifyEmbeds = VIDIFY_SERVERS.map((server, i) => makeVidifyEmbed(server, 230 - i));