mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-09 16:37:36 +00:00
fix some proxy handling and organize rive embeds
This commit is contained in:
parent
d26a52f67e
commit
b9752147db
5 changed files with 88 additions and 78 deletions
|
|
@ -3,47 +3,50 @@ import { makeEmbed } from '@/providers/base';
|
|||
|
||||
const providers = [
|
||||
{
|
||||
id: 'rive-hydrax',
|
||||
id: 'rive-guru',
|
||||
rank: 270,
|
||||
name: 'Guru (onionflixr/FlixHQ)',
|
||||
},
|
||||
{
|
||||
id: 'rive-fastx',
|
||||
id: 'rive-ghost',
|
||||
rank: 269,
|
||||
},
|
||||
{
|
||||
id: 'rive-filmecho',
|
||||
id: 'rive-putafilme',
|
||||
rank: 268,
|
||||
name: 'Putafilme - Multi',
|
||||
},
|
||||
{
|
||||
id: 'rive-nova',
|
||||
rank: 267,
|
||||
},
|
||||
{
|
||||
id: 'rive-guru',
|
||||
id: 'rive-asiacloud',
|
||||
rank: 266,
|
||||
},
|
||||
{
|
||||
id: 'rive-g1',
|
||||
id: 'rive-hydrax',
|
||||
rank: 265,
|
||||
},
|
||||
{
|
||||
id: 'rive-g2',
|
||||
id: 'rive-filmecho',
|
||||
rank: 264,
|
||||
name: 'NfMirror',
|
||||
},
|
||||
{
|
||||
id: 'rive-ee3',
|
||||
id: 'rive-fastx',
|
||||
rank: 263,
|
||||
},
|
||||
{
|
||||
id: 'rive-ghost',
|
||||
id: 'rive-g1',
|
||||
rank: 262,
|
||||
},
|
||||
{
|
||||
id: 'rive-putafilme',
|
||||
id: 'rive-g2',
|
||||
rank: 261,
|
||||
},
|
||||
{
|
||||
id: 'rive-asiacloud',
|
||||
id: 'rive-ee3',
|
||||
rank: 260,
|
||||
},
|
||||
{
|
||||
|
|
@ -52,13 +55,15 @@ const providers = [
|
|||
},
|
||||
];
|
||||
|
||||
function embed(provider: { id: string; rank: number; disabled?: boolean }) {
|
||||
function embed(provider: { id: string; rank: number; name?: string; disabled?: boolean }) {
|
||||
return makeEmbed({
|
||||
id: provider.id,
|
||||
name: provider.id
|
||||
.split('-')
|
||||
.map((word) => word[0].toUpperCase() + word.slice(1))
|
||||
.join(' '),
|
||||
name:
|
||||
provider.name ||
|
||||
provider.id
|
||||
.split('-')
|
||||
.map((word) => word[0].toUpperCase() + word.slice(1))
|
||||
.join(' '),
|
||||
disabled: provider.disabled,
|
||||
rank: provider.rank,
|
||||
async scrape(ctx) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const viperScraper = makeEmbed({
|
|||
const playlistUrl = apiResponse.body.source.replace(/^.*\/viper\//, 'https://');
|
||||
|
||||
// You need to set a proxy for flixhq CDN streams. Set up your own from this repo: https://github.com/Pasithea0/M3U8-Proxy
|
||||
const proxiedPlaylist = `https://m3u8.wafflehacker.io/m3u8-proxy?url=${encodeURIComponent(playlistUrl)}&headers=${encodeURIComponent(JSON.stringify({ referer: 'https://megacloud.store/', origin: 'https://megacloud.store' }))}`;
|
||||
const proxiedPlaylist = `https://proxy.fifthwit.net/m3u8-proxy?url=${encodeURIComponent(playlistUrl)}&headers=${encodeURIComponent(JSON.stringify({ referer: 'https://megacloud.store/', origin: 'https://megacloud.store' }))}`;
|
||||
|
||||
return {
|
||||
stream: [
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
}),
|
||||
);
|
||||
|
||||
processedUrl = `https://m3u8.wafflehacker.io/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`;
|
||||
processedUrl = `https://proxy.fifthwit.net/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`;
|
||||
} catch (jsonError) {
|
||||
console.error('Error decoding/parsing orbitproxy data:', jsonError);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,19 @@ function generateSecretKey(id: number | string) {
|
|||
return keyArray[index];
|
||||
}
|
||||
|
||||
function createProxyUrl(originalUrl: string, referer: string): string {
|
||||
const encodedUrl = encodeURIComponent(originalUrl);
|
||||
const encodedHeaders = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
referer,
|
||||
}),
|
||||
);
|
||||
|
||||
return `https://proxy.fifthwit.net/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`;
|
||||
}
|
||||
|
||||
function processProxiedURL(url: string): string {
|
||||
// Handle orbitproxy URLs
|
||||
if (url.includes('orbitproxy')) {
|
||||
try {
|
||||
const urlParts = url.split(/orbitproxy\.[^/]+\//);
|
||||
|
|
@ -84,20 +96,11 @@ function processProxiedURL(url: string): string {
|
|||
const encryptedPart = urlParts[1].split('.m3u8')[0];
|
||||
try {
|
||||
const decodedData = Buffer.from(encryptedPart, 'base64').toString('utf-8');
|
||||
|
||||
const jsonData = JSON.parse(decodedData);
|
||||
const originalUrl = jsonData.u;
|
||||
const referer = jsonData.r || '';
|
||||
|
||||
const encodedUrl = encodeURIComponent(originalUrl);
|
||||
const encodedHeaders = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
referer,
|
||||
}),
|
||||
);
|
||||
|
||||
const proxyUrl = `https://m3u8.wafflehacker.io/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`;
|
||||
return proxyUrl;
|
||||
return createProxyUrl(originalUrl, referer);
|
||||
} catch (jsonError) {
|
||||
console.error('Error decoding/parsing orbitproxy data:', jsonError);
|
||||
}
|
||||
|
|
@ -106,6 +109,12 @@ function processProxiedURL(url: string): string {
|
|||
console.error('Error processing orbitproxy URL:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle other proxied URLs
|
||||
if (url.includes('/m3u8-proxy?url=')) {
|
||||
return url.replace(/https:\/\/[^/]+\/m3u8-proxy/, 'https://proxy.fifthwit.net/m3u8-proxy');
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,49 @@ import { SourcererEmbed, SourcererOutput, makeSourcerer } from '@/providers/base
|
|||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
// REQUIRES A PROXY FOR MOST SERVERS set it up here https://github.com/Pasithea0/M3U8-Proxy
|
||||
function createProxyUrl(originalUrl: string, referer: string): string {
|
||||
const encodedUrl = encodeURIComponent(originalUrl);
|
||||
const encodedHeaders = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
referer,
|
||||
}),
|
||||
);
|
||||
|
||||
return `https://proxy.fifthwit.net/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`;
|
||||
}
|
||||
|
||||
function processProxiedURL(url: string): string {
|
||||
// Handle orbitproxy URLs
|
||||
if (url.includes('orbitproxy')) {
|
||||
try {
|
||||
const urlParts = url.split(/orbitproxy\.[^/]+\//);
|
||||
if (urlParts.length >= 2) {
|
||||
const encryptedPart = urlParts[1].split('.m3u8')[0];
|
||||
try {
|
||||
const decodedData = Buffer.from(encryptedPart, 'base64').toString('utf-8');
|
||||
const jsonData = JSON.parse(decodedData);
|
||||
const originalUrl = jsonData.u;
|
||||
const referer = jsonData.r || '';
|
||||
|
||||
return createProxyUrl(originalUrl, referer);
|
||||
} catch (jsonError) {
|
||||
console.error('Error decoding/parsing orbitproxy data:', jsonError);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error processing orbitproxy URL:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle other proxied URLs
|
||||
if (url.includes('/m3u8-proxy?url=')) {
|
||||
return url.replace(/https:\/\/[^/]+\/m3u8-proxy/, 'https://proxy.fifthwit.net/m3u8-proxy');
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
const getHost = () => {
|
||||
const urlObj = new URL(window.location.href);
|
||||
return `${urlObj.protocol}//${urlObj.host}`;
|
||||
|
|
@ -43,57 +86,10 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
|
||||
if (!servers.length) throw new NotFoundError('No server playlist found');
|
||||
|
||||
// Process orbitproxy.ru URLs so we can proxy yourself
|
||||
// REQUIRES A PROXY FOR MOST SERVERS set it up here https://github.com/Pasithea0/M3U8-Proxy
|
||||
const processedServers = await Promise.all(
|
||||
servers.map(async (server) => {
|
||||
if (server.url.includes('orbitproxy')) {
|
||||
try {
|
||||
const urlParts = server.url.split(/orbitproxy\.[^/]+\//);
|
||||
if (urlParts.length >= 2) {
|
||||
const encryptedPart = urlParts[1].split('.m3u8')[0];
|
||||
|
||||
try {
|
||||
const decodedData = Buffer.from(encryptedPart, 'base64').toString('utf-8');
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Decoded data:', decodedData);
|
||||
|
||||
const jsonData = JSON.parse(decodedData);
|
||||
|
||||
const originalUrl = jsonData.u;
|
||||
// const origin = jsonData.o || '';
|
||||
const referer = jsonData.r || '';
|
||||
|
||||
const encodedUrl = encodeURIComponent(originalUrl);
|
||||
const encodedHeaders = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
// origin,
|
||||
referer,
|
||||
}),
|
||||
);
|
||||
|
||||
const proxyUrl = `https://m3u8.wafflehacker.io/m3u8-proxy?url=${encodedUrl}&headers=${encodedHeaders}`; // bring your own
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Created proxy URL:', proxyUrl);
|
||||
|
||||
return {
|
||||
...server,
|
||||
url: proxyUrl,
|
||||
};
|
||||
} catch (jsonError) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error decoding/parsing orbitproxy data:', jsonError);
|
||||
return server;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error processing orbitproxy URL:', error);
|
||||
}
|
||||
}
|
||||
return server;
|
||||
}),
|
||||
);
|
||||
const processedServers = servers.map((server) => ({
|
||||
...server,
|
||||
url: processProxiedURL(server.url),
|
||||
}));
|
||||
|
||||
const embeds: SourcererEmbed[] = processedServers.map((server) => ({
|
||||
embedId: `server-${server.serverNumber}`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue