mirror of
https://github.com/p-stream/providers.git
synced 2026-04-21 08:22:20 +00:00
update various errors
This commit is contained in:
parent
8fb32e0cb8
commit
aeec008a54
2 changed files with 39 additions and 4 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
// --------
|
||||||
|
// READ
|
||||||
|
// There will be an ssl certificate error, you must use Node.js fetcher or browser fetcher.
|
||||||
|
// $ NODE_TLS_REJECT_UNAUTHORIZED=0 npm run cli -- --fetcher node-fetch --source-id streamwish-japanese --url "https://streamwish.to/e/abcdefc123"
|
||||||
|
// --------
|
||||||
|
|
||||||
import { flags } from '@/entrypoint/utils/targets';
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { makeEmbed } from '@/providers/base';
|
import { makeEmbed } from '@/providers/base';
|
||||||
|
|
||||||
|
|
@ -100,7 +108,7 @@ function unpack(packedCode: string): string {
|
||||||
const providers = [
|
const providers = [
|
||||||
{
|
{
|
||||||
id: 'streamwish-japanese',
|
id: 'streamwish-japanese',
|
||||||
name: 'StreamWish (Japones Sub Español)',
|
name: 'StreamWish (Japanese Sub Español)',
|
||||||
rank: 171,
|
rank: 171,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -133,7 +141,23 @@ function embed(provider: { id: string; name: string; rank: number }) {
|
||||||
'User-Agent': 'Mozilla/5.0',
|
'User-Agent': 'Mozilla/5.0',
|
||||||
};
|
};
|
||||||
|
|
||||||
const html = await ctx.proxiedFetcher<string>(ctx.url, { headers });
|
// console.log(`Fetching initial HTML from:`, ctx.url);
|
||||||
|
// console.log(`Request headers:`, headers);
|
||||||
|
|
||||||
|
let html: string;
|
||||||
|
try {
|
||||||
|
html = await ctx.proxiedFetcher<string>(ctx.url, { headers });
|
||||||
|
// console.log(`Successfully fetched HTML (${html.length} chars)`);
|
||||||
|
} catch (error) {
|
||||||
|
// console.error(`Failed to fetch initial HTML:`, error);
|
||||||
|
console.error(`Error details:`, {
|
||||||
|
message: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
cause: (error as any).cause || undefined,
|
||||||
|
url: ctx.url,
|
||||||
|
});
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
const obfuscatedScript = html.match(/<script[^>]*>\s*(eval\(function\(p,a,c,k,e,d.*?\)[\s\S]*?)<\/script>/);
|
const obfuscatedScript = html.match(/<script[^>]*>\s*(eval\(function\(p,a,c,k,e,d.*?\)[\s\S]*?)<\/script>/);
|
||||||
|
|
||||||
if (!obfuscatedScript) {
|
if (!obfuscatedScript) {
|
||||||
|
|
@ -160,10 +184,13 @@ function embed(provider: { id: string; name: string; rank: number }) {
|
||||||
videoUrl = `https://swiftplayers.com/${videoUrl.replace(/^\/+/g, '')}`;
|
videoUrl = `https://swiftplayers.com/${videoUrl.replace(/^\/+/g, '')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(`Attempting to fetch m3u8 from:`, videoUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const m3u8Content = await ctx.proxiedFetcher<string>(videoUrl, {
|
const m3u8Content = await ctx.proxiedFetcher<string>(videoUrl, {
|
||||||
headers: { Referer: ctx.url },
|
headers: { Referer: ctx.url },
|
||||||
});
|
});
|
||||||
|
// console.log(`Successfully fetched m3u8 content (${m3u8Content.length} chars)`);
|
||||||
|
|
||||||
const variants = Array.from(
|
const variants = Array.from(
|
||||||
m3u8Content.matchAll(/#EXT-X-STREAM-INF:[^\n]+\n(?!iframe)([^\n]*index[^\n]*\.m3u8[^\n]*)/gi),
|
m3u8Content.matchAll(/#EXT-X-STREAM-INF:[^\n]+\n(?!iframe)([^\n]*index[^\n]*\.m3u8[^\n]*)/gi),
|
||||||
|
|
@ -174,7 +201,15 @@ function embed(provider: { id: string; name: string; rank: number }) {
|
||||||
const base = videoUrl.substring(0, videoUrl.lastIndexOf('/') + 1);
|
const base = videoUrl.substring(0, videoUrl.lastIndexOf('/') + 1);
|
||||||
videoUrl = base + best[1];
|
videoUrl = base + best[1];
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
// console.error(`Failed to fetch m3u8 content:`, error);
|
||||||
|
// console.error(`m3u8 fetch error details:`, {
|
||||||
|
// message: error instanceof Error ? error.message : 'Unknown error',
|
||||||
|
// cause: (error as any).cause || undefined,
|
||||||
|
// url: videoUrl,
|
||||||
|
// referer: ctx.url,
|
||||||
|
// });
|
||||||
|
//
|
||||||
// Intentionally empty to suppress errors during variant fetching
|
// Intentionally empty to suppress errors during variant fetching
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,4 +234,4 @@ export const cuevana3Scraper = makeSourcerer({
|
||||||
scrapeShow: comboScraper,
|
scrapeShow: comboScraper,
|
||||||
});
|
});
|
||||||
|
|
||||||
// made by @moonpic
|
// made by @moonpic
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue