mirror of
https://github.com/p-stream/providers.git
synced 2026-03-11 09:45:36 +00:00
vidnest
This commit is contained in:
parent
58b229df40
commit
2f8add0e8c
3 changed files with 103 additions and 107 deletions
|
|
@ -45,7 +45,7 @@ import { supervideoScraper } from './embeds/supervideo';
|
|||
import { vidCloudScraper } from './embeds/vidcloud';
|
||||
import { vidhideEnglishScraper, vidhideLatinoScraper, vidhideSpanishScraper } from './embeds/vidhide';
|
||||
import { vidifyEmbeds } from './embeds/vidify';
|
||||
import { vidnestAllmoviesEmbed, vidnestHollymoviehdEmbed } from './embeds/vidnest';
|
||||
import { VidnestEmbeds } from './embeds/vidnest';
|
||||
import {
|
||||
VidsrcsuServer10Scraper,
|
||||
VidsrcsuServer11Scraper,
|
||||
|
|
@ -193,8 +193,7 @@ export function gatherAllEmbeds(): Array<Embed> {
|
|||
...vidifyEmbeds,
|
||||
...zunimeEmbeds,
|
||||
...AnimetsuEmbeds,
|
||||
vidnestHollymoviehdEmbed,
|
||||
vidnestAllmoviesEmbed,
|
||||
...VidnestEmbeds,
|
||||
myanimesubScraper,
|
||||
myanimedubScraper,
|
||||
filemoonScraper,
|
||||
|
|
|
|||
|
|
@ -1,103 +1,108 @@
|
|||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { makeEmbed } from '@/providers/base';
|
||||
import { HlsBasedStream } from '@/providers/streams';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
import { makeEmbed } from '../base';
|
||||
|
||||
const VIDNEST_SERVERS = ['hollymoviehd', 'allmovies'] as const;
|
||||
|
||||
const baseUrl = 'https://second.vidnest.fun';
|
||||
const PASSPHRASE = 'A7kP9mQeXU2BWcD4fRZV+Sg8yN0/M5tLbC1HJQwYe6pOKFaE3vTnPZsRuYdVmLq2';
|
||||
|
||||
async function decryptVidnestData(encryptedBase64: string): Promise<any> {
|
||||
const encryptedBytes = Uint8Array.from(atob(encryptedBase64), (c) => c.charCodeAt(0));
|
||||
const serverConfigs: Record<string, { streamDomains: string[] | null; origin: string; referer: string }> = {
|
||||
hollymoviehd: {
|
||||
streamDomains: ['pkaystream.cc', 'flashstream.cc'],
|
||||
origin: 'https://flashstream.cc',
|
||||
referer: 'https://flashstream.cc/',
|
||||
},
|
||||
allmovies: {
|
||||
streamDomains: null,
|
||||
origin: '',
|
||||
referer: '',
|
||||
},
|
||||
};
|
||||
|
||||
function base64ToUint8Array(base64: string): Uint8Array {
|
||||
const binaryString = atob(base64);
|
||||
const bytes = new Uint8Array(binaryString.length);
|
||||
for (let i = 0; i < binaryString.length; i++) {
|
||||
bytes[i] = binaryString.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
async function decryptVidnestData(encryptedBase64: string): Promise<any> {
|
||||
const encryptedBytes = base64ToUint8Array(encryptedBase64);
|
||||
const iv = encryptedBytes.slice(0, 12);
|
||||
const ciphertext = encryptedBytes.slice(12, -16);
|
||||
const tag = encryptedBytes.slice(-16);
|
||||
const keyData = base64ToUint8Array(PASSPHRASE).slice(0, 32);
|
||||
|
||||
const keyData = Uint8Array.from(atob(PASSPHRASE), (c) => c.charCodeAt(0)).slice(0, 32);
|
||||
const key = await crypto.subtle.importKey('raw', keyData, { name: 'AES-GCM' }, false, ['decrypt']);
|
||||
const cryptoKey = await crypto.subtle.importKey('raw', keyData, { name: 'AES-GCM' }, false, ['decrypt']);
|
||||
|
||||
const encrypted = new Uint8Array([...ciphertext, ...tag]);
|
||||
const combined = new Uint8Array(ciphertext.length + tag.length);
|
||||
combined.set(ciphertext, 0);
|
||||
combined.set(tag, ciphertext.length);
|
||||
|
||||
try {
|
||||
const decrypted = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, encrypted);
|
||||
|
||||
const decryptedText = new TextDecoder().decode(decrypted);
|
||||
return JSON.parse(decryptedText);
|
||||
} catch (error) {
|
||||
throw new NotFoundError('Failed to decrypt data');
|
||||
}
|
||||
const decrypted = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, cryptoKey, combined);
|
||||
return JSON.parse(new TextDecoder('utf-8').decode(decrypted));
|
||||
}
|
||||
|
||||
export const vidnestHollymoviehdEmbed = makeEmbed({
|
||||
id: 'vidnest-hollymoviehd',
|
||||
name: 'Vidnest HollyMovie',
|
||||
rank: 104,
|
||||
flags: [],
|
||||
disabled: false,
|
||||
async scrape(ctx) {
|
||||
const response = await ctx.proxiedFetcher<any>(ctx.url);
|
||||
if (!response.data) throw new NotFoundError('No encrypted data found');
|
||||
export function makeVidnestEmbed(id: string, rank: number = 100) {
|
||||
const config = serverConfigs[id];
|
||||
|
||||
const decryptedData = await decryptVidnestData(response.data);
|
||||
if (!decryptedData.success && !decryptedData.sources) throw new NotFoundError('No streams found');
|
||||
return makeEmbed({
|
||||
id: `vidnest-${id}`,
|
||||
name: `Vidnest ${id}`,
|
||||
rank,
|
||||
disabled: false,
|
||||
flags: [],
|
||||
async scrape(ctx) {
|
||||
const query = JSON.parse(ctx.url);
|
||||
const { type, tmdbId, season, episode } = query;
|
||||
|
||||
const sources = decryptedData.sources || decryptedData.streams;
|
||||
const streams: HlsBasedStream[] = [];
|
||||
const endpoint = type === 'movie' ? `/${id}/movie/${tmdbId}` : `/${id}/tv/${tmdbId}/${season}/${episode}`;
|
||||
|
||||
const streamHeaders = {
|
||||
Origin: 'https://flashstream.cc',
|
||||
Referer: 'https://flashstream.cc/',
|
||||
};
|
||||
const res = await ctx.proxiedFetcher<{ data?: string }>(endpoint, {
|
||||
baseUrl,
|
||||
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',
|
||||
},
|
||||
});
|
||||
|
||||
for (const source of sources) {
|
||||
if (source.file && (source.file.includes('pkaystream.cc') || source.file.includes('flashstream.cc'))) {
|
||||
streams.push({
|
||||
id: `hollymoviehd-${source.label || 'default'}`,
|
||||
type: 'hls',
|
||||
playlist: source.file,
|
||||
flags: [],
|
||||
captions: [],
|
||||
headers: streamHeaders,
|
||||
skipValidation: true,
|
||||
} as HlsBasedStream);
|
||||
if (!res?.data) throw new NotFoundError('No data');
|
||||
|
||||
const decrypted = await decryptVidnestData(res.data);
|
||||
const sources = decrypted.sources || decrypted.streams || [];
|
||||
|
||||
const streams: string[] = [];
|
||||
for (const source of sources) {
|
||||
const url = source.file || source.url;
|
||||
if (!url) continue;
|
||||
if (config?.streamDomains && !config.streamDomains.some((d) => url.includes(d))) continue;
|
||||
streams.push(url);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
stream: streams,
|
||||
};
|
||||
},
|
||||
});
|
||||
if (!streams.length) throw new NotFoundError('No streams');
|
||||
|
||||
export const vidnestAllmoviesEmbed = makeEmbed({
|
||||
id: 'vidnest-allmovies',
|
||||
name: 'Vidnest AllMovies (Hindi)',
|
||||
rank: 103,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
disabled: false,
|
||||
async scrape(ctx) {
|
||||
const response = await ctx.proxiedFetcher<any>(ctx.url);
|
||||
if (!response.data) throw new NotFoundError('No encrypted data found');
|
||||
ctx.progress(100);
|
||||
|
||||
const decryptedData = await decryptVidnestData(response.data);
|
||||
if (!decryptedData.success && !decryptedData.streams) throw new NotFoundError('No streams found');
|
||||
return {
|
||||
stream: [
|
||||
{
|
||||
id,
|
||||
type: 'hls',
|
||||
playlist: streams[0],
|
||||
headers: {
|
||||
Origin: config?.origin,
|
||||
Referer: config?.referer,
|
||||
},
|
||||
flags: [],
|
||||
captions: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const sources = decryptedData.sources || decryptedData.streams;
|
||||
const streams = [];
|
||||
|
||||
for (const stream of sources) {
|
||||
streams.push({
|
||||
id: `allmovies-${stream.language || 'default'}`,
|
||||
type: 'hls',
|
||||
playlist: stream.url || stream.file,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
captions: [],
|
||||
preferredHeaders: stream.headers || {},
|
||||
skipValidation: true,
|
||||
} as HlsBasedStream);
|
||||
}
|
||||
|
||||
return {
|
||||
stream: streams,
|
||||
};
|
||||
},
|
||||
});
|
||||
export const VidnestEmbeds = VIDNEST_SERVERS.map((server, i) => makeVidnestEmbed(server, 104 - i));
|
||||
|
|
|
|||
|
|
@ -1,29 +1,22 @@
|
|||
import { makeSourcerer } from '@/providers/base';
|
||||
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
|
||||
const backendUrl = 'https://second.vidnest.fun';
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const query: Record<string, any> = {
|
||||
type: ctx.media.type,
|
||||
tmdbId: ctx.media.tmdbId,
|
||||
};
|
||||
|
||||
const servers = ['hollymoviehd', 'allmovies'];
|
||||
|
||||
async function scrape(ctx: MovieScrapeContext | ShowScrapeContext, type: 'movie' | 'tv') {
|
||||
const embeds = [];
|
||||
|
||||
for (const server of servers) {
|
||||
let url = '';
|
||||
if (type === 'movie') {
|
||||
url = `${backendUrl}/${server}/movie/${ctx.media.tmdbId}`;
|
||||
} else if (ctx.media.type === 'show') {
|
||||
url = `${backendUrl}/${server}/tv/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}`;
|
||||
}
|
||||
|
||||
embeds.push({
|
||||
embedId: `vidnest-${server}`,
|
||||
url,
|
||||
});
|
||||
if (ctx.media.type === 'show') {
|
||||
query.season = ctx.media.season.number;
|
||||
query.episode = ctx.media.episode.number;
|
||||
}
|
||||
|
||||
return {
|
||||
embeds,
|
||||
embeds: [
|
||||
{ embedId: 'vidnest-hollymoviehd', url: JSON.stringify(query) },
|
||||
{ embedId: 'vidnest-allmovies', url: JSON.stringify(query) },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -31,8 +24,7 @@ export const vidnestScraper = makeSourcerer({
|
|||
id: 'vidnest',
|
||||
name: 'Vidnest',
|
||||
rank: 115,
|
||||
disabled: true,
|
||||
flags: [],
|
||||
scrapeMovie: (ctx: MovieScrapeContext) => scrape(ctx, 'movie'),
|
||||
scrapeShow: (ctx: ShowScrapeContext) => scrape(ctx, 'tv'),
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue