mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-27 18:40:31 +02:00
use packer for upstream
This commit is contained in:
@ -83,7 +83,6 @@ class Mixdrop implements Match {
|
|||||||
async match(match: RegExpMatchArray): Promise<string> {
|
async match(match: RegExpMatchArray): Promise<string> {
|
||||||
let unpacked = unPack(match[0])
|
let unpacked = unPack(match[0])
|
||||||
let url = unpacked.match(/(?<=MDCore.wurl=").*(?=")/)[0]
|
let url = unpacked.match(/(?<=MDCore.wurl=").*(?=")/)[0]
|
||||||
|
|
||||||
return `https:${url}`
|
return `https:${url}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +101,6 @@ class Mp4Upload implements Match {
|
|||||||
let unpacked = unPack(match[0])
|
let unpacked = unPack(match[0])
|
||||||
console.log(unpacked)
|
console.log(unpacked)
|
||||||
let url = unpacked.match(/(?<=player.src\(").*(?=")/)[0]
|
let url = unpacked.match(/(?<=player.src\(").*(?=")/)[0]
|
||||||
console.log(url)
|
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,14 +158,16 @@ class Streamzz implements Match {
|
|||||||
class Upstream implements Match {
|
class Upstream implements Match {
|
||||||
name = 'Upstream'
|
name = 'Upstream'
|
||||||
id = 'upstream'
|
id = 'upstream'
|
||||||
reliability = Reliability.NORMAL
|
reliability = Reliability.HIGH
|
||||||
domains = [
|
domains = [
|
||||||
'upstream.to'
|
'upstream.to'
|
||||||
]
|
]
|
||||||
regex = new RegExp(/(?<=\|)\w{2,}/gms)
|
regex = new RegExp(/eval\(function\(p,a,c,k,e,d\).*?(?=\<\/script\>)/gms)
|
||||||
|
|
||||||
async match(match: RegExpMatchArray): Promise<string> {
|
async match(match: RegExpMatchArray): Promise<string> {
|
||||||
return `https://${match[49]}.upstreamcdn.co/hls/${match[148]}/master.m3u8`
|
let unpacked = unPack(match[0])
|
||||||
|
let url = unpacked.match(/(?<=file:").*(?=")/)[0]
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +225,7 @@ class Kwik implements Match {
|
|||||||
async match(match: RegExpMatchArray): Promise<string> {
|
async match(match: RegExpMatchArray): Promise<string> {
|
||||||
let unpacked = unPack(match[0])
|
let unpacked = unPack(match[0])
|
||||||
let url = unpacked.match(/(?<=source=').*(?=')/)[0]
|
let url = unpacked.match(/(?<=source=').*(?=')/)[0]
|
||||||
|
console.log(url)
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,60 +1,19 @@
|
|||||||
export const unPack = (packed: String): String => {
|
export const unPack = (packed: String): any => {
|
||||||
// Use eval() for the unPack script because else the `env` variable will not be in scope when the eval in the script is called
|
// Adapted from http://matthewfl.com/unPacker.html by matthew@matthewfl.com
|
||||||
const scriptlet = String.raw`
|
|
||||||
//////////////////////////////////////////
|
|
||||||
// Un pack the code from the /packer/ //
|
|
||||||
// By matthew@matthewfl.com //
|
|
||||||
// http://matthewfl.com/unPacker.html //
|
|
||||||
//////////////////////////////////////////
|
|
||||||
// version 1.2
|
|
||||||
|
|
||||||
|
let context = `
|
||||||
(function (code) {
|
{
|
||||||
function indent (code) {
|
|
||||||
try {
|
|
||||||
var tabs = 0, old=-1, add='';
|
|
||||||
for(var i=0;i<code.length;i++) {
|
|
||||||
if(code[i].indexOf("{") != -1) tabs++;
|
|
||||||
if(code[i].indexOf("}") != -1) tabs--;
|
|
||||||
|
|
||||||
if(old != tabs) {
|
|
||||||
old = tabs;
|
|
||||||
add = "";
|
|
||||||
while (old > 0) {
|
|
||||||
add += "\t";
|
|
||||||
old--;
|
|
||||||
}
|
|
||||||
old = tabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
code[i] = add + code[i];
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
tabs = null;
|
|
||||||
old = null;
|
|
||||||
add = null;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
var env = {
|
|
||||||
eval: function (c) {
|
eval: function (c) {
|
||||||
code = c;
|
packed = c;
|
||||||
},
|
},
|
||||||
window: {},
|
window: {},
|
||||||
document: {}
|
document: {}
|
||||||
};
|
}
|
||||||
|
`
|
||||||
eval("with(env) {" + code + "}");
|
|
||||||
|
eval(`with(${context}) { ` + packed + '}')
|
||||||
code = (code+"").replace(/;/g, ";\n").replace(/{/g, "\n{\n").replace(/}/g, "\n}\n").replace(/\n;\n/g, ";\n").replace(/\n\\n/g, "\n");
|
|
||||||
|
packed = (packed+"").replace(/;/g, ";\n").replace(/{/g, "\n{\n").replace(/}/g, "\n}\n").replace(/\n;\n/g, ";\n").replace(/\n\\n/g, "\n");
|
||||||
code = code.split("\n");
|
|
||||||
code = indent(code);
|
return packed
|
||||||
|
|
||||||
code = code.join("\n");
|
|
||||||
return code;
|
|
||||||
})(${'String.raw`'}` + packed + String.raw`${'`'})`
|
|
||||||
|
|
||||||
return eval(scriptlet);
|
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
document.title = `Stream Bypass (${domain})`
|
document.title = `Stream Bypass (${domain})`
|
||||||
|
|
||||||
new URL(url).pathname.contains('.m3u8') ? await play_hls(url) : await play_native(url)
|
new URL(url).pathname.endsWith('.m3u8') ? await play_hls(url) : await play_native(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user