ayuda con fastream

  • Autor Autor Armandolqr
  • Fecha de inicio Fecha de inicio
Armandolqr

Armandolqr

Gamma
Verificado por Whatsapp
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
como puedo hacer el get con la ip del usuario o algo que evite el bloqueo del m3u8 https://fas.freeserver1.workers.dev/?v=https://fastream.to/embed-3aoxast68rvp.html {
"sources": [
{
"file": "https://s39.fastream.to/hls2/03/000...2g&s=1744648576&e=43200&v=39184542&i=0.3&sp=0"
}
]
}







addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
})
async function handleRequest(request) {
const url = new URL(request.url);
const filelink = url.searchParams.get('v');
if (!filelink || !filelink.includes('fastream.')) {
return new Response(JSON.stringify({ error: 'Invalid video link' }), {
status: 400,
headers: { 'Content-Type': 'application/json' },
});
}
// Realizar la solicitud HTTP a Fastream
const fastreamResponse = await fetch(filelink, {
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:81.0) Gecko/20100101 Firefox/81.0',
'Referer': 'https://fastream.to/',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
},
});
if (!fastreamResponse.ok) {
return new Response(JSON.stringify({ error: 'Failed to fetch video data' }), {
status: 500,
headers: { 'Content-Type': 'application/json' },
});
}
const html = await fastreamResponse.text();
// Si el código está empaquetado, intentamos desempaquetarlo
let unpackedHtml = html;
if (/eval\(function\(p,a,c,k,e,[rd]/.test(html)) {
unpackedHtml = jsUnpack(html);
}
// Extraer el enlace del archivo .m3u8
const match = unpackedHtml.match(/file\s*:\s*"([^"]+)"/);
if (match && match[1]) {
const videoUrl = match[1];
return new Response(
JSON.stringify({ sources: [{ file: videoUrl }] }, null, 2),
{
headers: { 'Content-Type': 'application/json' },
}
);
} else {
return new Response(JSON.stringify({ error: 'Video URL not found' }), {
status: 404,
headers: { 'Content-Type': 'application/json' },
});
}
}
// Función para desempaquetar JavaScript (similitud con JavaScriptUnpacker.php)
function jsUnpack(content) {
const regex = /}\('(.)', *(\d+), *(\d+), *'(.?)'\.split\('\|'\)/;
const match = regex.exec(content);
if (!match) return content;
const payload = match[1];
const radix = parseInt(match[2], 10);
const count = parseInt(match[3], 10);
const symtab = match[4].split('|');
if (count !== symtab.length) return content; // Error de formato
const unbaser = new Unbaser(radix);
let result = payload.replace(/\b\w+\b/g, (word) => {
return symtab[unbaser.unbase(word)] || word;
});
result = result.replace(/\\/g, ''); // Limpiar las barras invertidas
return result;
}
class Unbaser {
constructor(base) {
this.base = base;
this.selector = 52;
this.ALPHABET = {
52: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP',
54: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR',
62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
95: ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
};
if (this.base > 62) this.selector = 95;
else if (this.base > 54) this.selector = 62;
else if (this.base > 52) this.selector = 54;
}
unbase(val) {
if (2 <= this.base && this.base <= 36) {
return parseInt(val, this.base);
} else {
if (!this.dict) {
this.dict = Object.fromEntries(
Array.from(this.ALPHABET[this.selector]).map((char, index) => [char, index])
);
}
let ret = 0;
const valArray = Array.from(val).reverse();
for (let i = 0; i < valArray.length; i++) {
const cipher = valArray;
ret += Math.pow(this.base, i) * this.dict[cipher];
}
return ret;
}
}
}
 
tienes 2 opciones, crear un PLUGIN, que el usuario instale en su navegador y asi usar su IP, para solicitar el trafico y Saltarte el CORS de la web destino. o hacer un WEBAPP (ejecutable) que sea un navegador embebido como con ELECTRON o algun similar y tener control de ello.
 
Atrás
Arriba