mirror of
https://github.com/p-stream/providers.git
synced 2026-05-14 11:21:20 +00:00
add cinemaos
Revert "enable flowcast" This reverts commit 65a63b14bfadad3d006091eba3190ec8f0633bb4. enable flowcast disable hexa api cleaning a lot of stuff add proxy add hexa server clean up source disable select sources more
This commit is contained in:
parent
a64c7ee84d
commit
69f3a1c01e
4 changed files with 112 additions and 45 deletions
|
|
@ -220,5 +220,6 @@ export function gatherAllEmbeds(): Array<Embed> {
|
||||||
streamwishEnglishScraper,
|
streamwishEnglishScraper,
|
||||||
streamtapeLatinoScraper,
|
streamtapeLatinoScraper,
|
||||||
...cinemaosEmbeds,
|
...cinemaosEmbeds,
|
||||||
|
// ...cinemaosHexaEmbeds,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
import { flags } from '@/entrypoint/utils/targets';
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { EmbedOutput, makeEmbed } from '@/providers/base';
|
import { EmbedOutput, makeEmbed } from '@/providers/base';
|
||||||
import { NotFoundError } from '@/utils/errors';
|
import { NotFoundError } from '@/utils/errors';
|
||||||
|
import { createM3U8ProxyUrl } from '@/utils/proxy';
|
||||||
|
|
||||||
const CINEMAOS_API = 'https://cinemaos-v3.vercel.app/api/neo/backendfetch';
|
const CINEMAOS_API = atob('aHR0cHM6Ly9jaW5lbWFvcy12My52ZXJjZWwuYXBwL2FwaS9uZW8vYmFja2VuZGZldGNo');
|
||||||
|
|
||||||
export function makeCinemaOSEmbed(server: string, rank: number) {
|
export function makeCinemaOSEmbed(server: string, rank: number) {
|
||||||
return makeEmbed({
|
return makeEmbed({
|
||||||
id: `cinemaos-${server}`,
|
id: `cinemaos-${server}`,
|
||||||
name: `CinemaOS: ${server.charAt(0).toUpperCase() + server.slice(1)}`,
|
name: `${server.charAt(0).toUpperCase() + server.slice(1)}`,
|
||||||
rank,
|
rank,
|
||||||
async scrape(ctx): Promise<EmbedOutput> {
|
async scrape(ctx): Promise<EmbedOutput> {
|
||||||
const query = JSON.parse(ctx.url);
|
const query = JSON.parse(ctx.url);
|
||||||
|
|
@ -22,6 +23,9 @@ export function makeCinemaOSEmbed(server: string, rank: number) {
|
||||||
if (!sources || !Array.isArray(sources) || sources.length === 0) {
|
if (!sources || !Array.isArray(sources) || sources.length === 0) {
|
||||||
throw new NotFoundError('No sources found');
|
throw new NotFoundError('No sources found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.progress(80);
|
||||||
|
|
||||||
// If only one source, return as a single HLS stream
|
// If only one source, return as a single HLS stream
|
||||||
if (sources.length === 1) {
|
if (sources.length === 1) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -37,11 +41,17 @@ export function makeCinemaOSEmbed(server: string, rank: number) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// If multiple sources, treat as file with qualities
|
// If multiple sources, treat as file with qualities
|
||||||
const qualityMap: Record<string, { type: 'mp4'; url: string }> = {};
|
const qualityMap: Record<number, { type: 'mp4'; url: string }> = {};
|
||||||
for (const src of sources) {
|
for (const src of sources) {
|
||||||
// Use quality or source as the key, fallback to 'unknown'
|
const quality = (src.quality || src.source || 'unknown').toString();
|
||||||
const key = (src.quality || src.source || 'unknown').toString();
|
let qualityKey: number;
|
||||||
qualityMap[key] = {
|
if (quality === '4K') {
|
||||||
|
qualityKey = 2160;
|
||||||
|
} else {
|
||||||
|
qualityKey = parseInt(quality.replace('P', ''), 10);
|
||||||
|
}
|
||||||
|
if (Number.isNaN(qualityKey) || qualityMap[qualityKey]) continue;
|
||||||
|
qualityMap[qualityKey] = {
|
||||||
type: 'mp4',
|
type: 'mp4',
|
||||||
url: src.url,
|
url: src.url,
|
||||||
};
|
};
|
||||||
|
|
@ -63,28 +73,66 @@ export function makeCinemaOSEmbed(server: string, rank: number) {
|
||||||
|
|
||||||
// List of supported servers and their ranks (descending order)
|
// List of supported servers and their ranks (descending order)
|
||||||
const CINEMAOS_SERVERS = [
|
const CINEMAOS_SERVERS = [
|
||||||
'flowcast',
|
// 'flowcast',
|
||||||
'shadow',
|
'shadow',
|
||||||
'asiacloud',
|
'asiacloud',
|
||||||
'hindicast',
|
// 'hindicast',
|
||||||
'anime',
|
// 'anime',
|
||||||
'animez',
|
// 'animez',
|
||||||
'guard',
|
// 'guard',
|
||||||
'hq',
|
// 'hq',
|
||||||
'ninja',
|
// 'ninja',
|
||||||
'alpha',
|
// 'alpha',
|
||||||
'kaze',
|
// 'kaze',
|
||||||
'zenith',
|
// 'zenith',
|
||||||
'cast',
|
// 'cast',
|
||||||
'ghost',
|
// 'ghost',
|
||||||
'halo',
|
// 'halo',
|
||||||
'kinoecho',
|
// 'kinoecho',
|
||||||
'ee3',
|
// 'ee3',
|
||||||
'volt',
|
// 'volt',
|
||||||
'putafilme',
|
// 'putafilme',
|
||||||
'ophim',
|
'ophim',
|
||||||
'kage',
|
// 'kage',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Export all embeds
|
|
||||||
export const cinemaosEmbeds = CINEMAOS_SERVERS.map((server, i) => makeCinemaOSEmbed(server, 300 - i));
|
export const cinemaosEmbeds = CINEMAOS_SERVERS.map((server, i) => makeCinemaOSEmbed(server, 300 - i));
|
||||||
|
|
||||||
|
export function makeCinemaOSHexaEmbed(id: string, rank: number = 100) {
|
||||||
|
return makeEmbed({
|
||||||
|
id: `cinemaos-hexa-${id}`,
|
||||||
|
name: `Hexa ${id.charAt(0).toUpperCase() + id.slice(1)}`,
|
||||||
|
disabled: true,
|
||||||
|
rank,
|
||||||
|
async scrape(ctx): Promise<EmbedOutput> {
|
||||||
|
const query = JSON.parse(ctx.url);
|
||||||
|
const directUrl = query.directUrl;
|
||||||
|
if (!directUrl) {
|
||||||
|
throw new NotFoundError('No directUrl provided for Hexa embed');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Headers needed for the M3U8 proxy
|
||||||
|
const headers = {
|
||||||
|
referer: 'https://megacloud.store/',
|
||||||
|
origin: 'https://megacloud.store',
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
stream: [
|
||||||
|
{
|
||||||
|
id: 'primary',
|
||||||
|
type: 'hls',
|
||||||
|
playlist: createM3U8ProxyUrl(directUrl, headers),
|
||||||
|
flags: [flags.CORS_ALLOWED],
|
||||||
|
captions: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// List of all Hexa servers and their rank (descending order)
|
||||||
|
export const HEXA_SERVERS = ['alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india'];
|
||||||
|
|
||||||
|
export const cinemaosHexaEmbeds = HEXA_SERVERS.map((server, i) => makeCinemaOSHexaEmbed(server, 315 - i));
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||||
|
|
||||||
|
// const baseUrl = atob('aHR0cHM6Ly9jaW5lbWFvcy12My52ZXJjZWwuYXBwLw==');
|
||||||
|
|
||||||
const CINEMAOS_SERVERS = [
|
const CINEMAOS_SERVERS = [
|
||||||
// 'flowcast',
|
// 'flowcast',
|
||||||
'shadow',
|
'shadow',
|
||||||
|
|
@ -15,30 +17,19 @@ const CINEMAOS_SERVERS = [
|
||||||
// 'alpha',
|
// 'alpha',
|
||||||
// 'kaze',
|
// 'kaze',
|
||||||
// 'zenith',
|
// 'zenith',
|
||||||
'cast',
|
// 'cast',
|
||||||
// 'ghost',
|
// 'ghost',
|
||||||
'halo',
|
// 'halo',
|
||||||
'kinoecho',
|
// 'kinoecho',
|
||||||
// 'ee3',
|
// 'ee3',
|
||||||
'volt',
|
// 'volt',
|
||||||
// 'putafilme',
|
// 'putafilme',
|
||||||
'ophim',
|
'ophim',
|
||||||
// 'kage',
|
// 'kage',
|
||||||
];
|
];
|
||||||
|
|
||||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||||
const res = await ctx.proxiedFetcher(
|
const embeds = [];
|
||||||
'https://cinemaos-v3.vercel.app/api/neo/backendfetch?requestID=VideoProviderServices',
|
|
||||||
);
|
|
||||||
let availableServers = [];
|
|
||||||
try {
|
|
||||||
const data = typeof res === 'string' ? JSON.parse(res) : res;
|
|
||||||
availableServers = Array.isArray(data?.data) ? data.data : [];
|
|
||||||
} catch (e) {
|
|
||||||
availableServers = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const filteredServers = availableServers.filter((server: string) => CINEMAOS_SERVERS.includes(server));
|
|
||||||
|
|
||||||
const query: any = {
|
const query: any = {
|
||||||
type: ctx.media.type,
|
type: ctx.media.type,
|
||||||
|
|
@ -50,14 +41,39 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
||||||
query.episode = ctx.media.episode.number;
|
query.episode = ctx.media.episode.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const embeds = filteredServers.map((server: string) => ({
|
// // V2 Embeds / Hexa
|
||||||
embedId: `cinemaos-${server}`,
|
// try {
|
||||||
url: JSON.stringify({ ...query, service: server }),
|
// const hexaUrl = `api/hexa?type=${query.type}&tmdbId=${query.tmdbId}`;
|
||||||
}));
|
// const hexaRes = await ctx.proxiedFetcher(hexaUrl, { baseUrl });
|
||||||
|
// const hexaData = typeof hexaRes === 'string' ? JSON.parse(hexaRes) : hexaRes;
|
||||||
|
// if (hexaData && hexaData.sources && typeof hexaData.sources === 'object') {
|
||||||
|
// for (const [key, value] of Object.entries<any>(hexaData.sources)) {
|
||||||
|
// if (value && value.url) {
|
||||||
|
// embeds.push({
|
||||||
|
// embedId: `cinemaos-hexa-${key}`,
|
||||||
|
// url: JSON.stringify({ ...query, service: `hexa-${key}`, directUrl: value.url }),
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (e: any) {
|
||||||
|
// // eslint-disable-next-line no-console
|
||||||
|
// console.error('Failed to fetch hexa sources');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// V3 Embeds
|
||||||
|
for (const server of CINEMAOS_SERVERS) {
|
||||||
|
embeds.push({
|
||||||
|
embedId: `cinemaos-${server}`,
|
||||||
|
url: JSON.stringify({ ...query, service: server }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(embeds);
|
console.log(embeds);
|
||||||
|
|
||||||
|
ctx.progress(50);
|
||||||
|
|
||||||
return { embeds };
|
return { embeds };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import {
|
||||||
oneServerPrimeboxEmbed,
|
oneServerPrimeboxEmbed,
|
||||||
oneServerVidsrcsuEmbed,
|
oneServerVidsrcsuEmbed,
|
||||||
} from '@/providers/embeds/1server';
|
} from '@/providers/embeds/1server';
|
||||||
|
import { cinemaosHexaEmbeds } from '@/providers/embeds/cinemaos';
|
||||||
import {
|
import {
|
||||||
ConsumetStreamSBScraper,
|
ConsumetStreamSBScraper,
|
||||||
ConsumetStreamTapeScraper,
|
ConsumetStreamTapeScraper,
|
||||||
|
|
@ -87,6 +88,7 @@ const SKIP_VALIDATION_CHECK_IDS = [
|
||||||
oneServerAnimepaheEmbed.id,
|
oneServerAnimepaheEmbed.id,
|
||||||
oneServerAnizoneEmbed.id,
|
oneServerAnizoneEmbed.id,
|
||||||
wecimaScraper.id,
|
wecimaScraper.id,
|
||||||
|
...cinemaosHexaEmbeds.map((e) => e.id),
|
||||||
];
|
];
|
||||||
|
|
||||||
export function isValidStream(stream: Stream | undefined): boolean {
|
export function isValidStream(stream: Stream | undefined): boolean {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue