mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-27 18:40:31 +02:00
add Kwik, use unpacker to improve reliabilty
This commit is contained in:
@ -2,6 +2,7 @@ import {getMatch} from "./match/match";
|
|||||||
import {storageDelete, storageGet, storageSet} from "./store/store";
|
import {storageDelete, storageGet, storageSet} from "./store/store";
|
||||||
import {Match} from "./match/matches";
|
import {Match} from "./match/matches";
|
||||||
|
|
||||||
|
|
||||||
chrome.webRequest.onBeforeRedirect.addListener(async details => {
|
chrome.webRequest.onBeforeRedirect.addListener(async details => {
|
||||||
// check if redirects origins from a previous redirect
|
// check if redirects origins from a previous redirect
|
||||||
if (await storageGet('redirect') === undefined) {
|
if (await storageGet('redirect') === undefined) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Stream Bypass",
|
"name": "Stream Bypass",
|
||||||
"author": "ByteDream",
|
"author": "ByteDream",
|
||||||
"description": "A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.",
|
"description": "A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"homepage_url": "https://github.com/ByteDream/stream-bypass",
|
"homepage_url": "https://github.com/ByteDream/stream-bypass",
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import {unPack} from "./unpack";
|
||||||
|
|
||||||
export enum Reliability {
|
export enum Reliability {
|
||||||
HIGH,
|
HIGH,
|
||||||
NORMAL,
|
NORMAL,
|
||||||
@ -71,41 +73,40 @@ class Filemoon implements Match {
|
|||||||
class Mixdrop implements Match {
|
class Mixdrop implements Match {
|
||||||
name = 'Mixdrop'
|
name = 'Mixdrop'
|
||||||
id = 'mixdrop'
|
id = 'mixdrop'
|
||||||
reliability = Reliability.NORMAL
|
reliability = Reliability.HIGH
|
||||||
domains = [
|
domains = [
|
||||||
'mixdrop.co',
|
'mixdrop.co',
|
||||||
'mixdrop.to',
|
'mixdrop.to',
|
||||||
'mixdrop.ch',
|
'mixdrop.ch',
|
||||||
'mixdrop.bz'
|
'mixdrop.bz',
|
||||||
|
'mixdrop.gl'
|
||||||
]
|
]
|
||||||
regex = new RegExp(/(?<=\|)\w{2,}/gm)
|
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> {
|
||||||
const prefix = /(?<=\/\/)[a|s](?=-)/.exec(document.body.innerHTML)[0]
|
let unpacked = unPack(match[0])
|
||||||
const subdomain = match[1].length < match[2].length ? match[1] : match[2]
|
let url = unpacked.match(/(?<=MDCore.wurl=").*(?=")/)[0]
|
||||||
const domain = match.slice().sort((a, b) => b.length - a.length).find(m => /^[a-z]+$/.test(m))
|
|
||||||
const id = match[1].length > match[2].length ? match[1] : match[2]
|
|
||||||
const tld = match.find(m => ['net', 'io', 'to', 'sx', 'com'].indexOf(m) !== -1)
|
|
||||||
const s = match.slice().sort((a, b) => b.length - a.length).slice(1)[0]
|
|
||||||
const e_t = match.find(m => m.length === 10 && !isNaN(parseInt(m)))
|
|
||||||
|
|
||||||
return `https://${prefix}-${subdomain}.${domain}.${tld}/v/${id}.mp4?s=${s}&e=${e_t}&_t=${e_t}`
|
return `https:${url}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Mp4Upload implements Match {
|
class Mp4Upload implements Match {
|
||||||
name = 'Mp4Upload'
|
name = 'Mp4Upload'
|
||||||
id = 'mp4upload'
|
id = 'mp4upload'
|
||||||
reliability = Reliability.NORMAL
|
reliability = Reliability.HIGH
|
||||||
domains = [
|
domains = [
|
||||||
'mp4upload.com'
|
'mp4upload.com'
|
||||||
]
|
]
|
||||||
replace = true
|
replace = true
|
||||||
regex = new RegExp(/(?<=\|)\w{2,}/gm)
|
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> {
|
||||||
let id = match.slice().reduce((a, b) => a.length >= b.length ? a : b)
|
let unpacked = unPack(match[0])
|
||||||
return `https://www4.mp4upload.com:282/d/${id}/video.mp4`
|
console.log(unpacked)
|
||||||
|
let url = unpacked.match(/(?<=player.src\(").*(?=")/)[0]
|
||||||
|
console.log(url)
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +167,7 @@ class Upstream implements Match {
|
|||||||
domains = [
|
domains = [
|
||||||
'upstream.to'
|
'upstream.to'
|
||||||
]
|
]
|
||||||
regex = new RegExp(/(?<=\|)\w{2,}/gm)
|
regex = new RegExp(/(?<=\|)\w{2,}/gms)
|
||||||
|
|
||||||
async match(match: RegExpMatchArray): Promise<string> {
|
async match(match: RegExpMatchArray): Promise<string> {
|
||||||
return `https://${match[49]}.upstreamcdn.co/hls/${match[148]}/master.m3u8`
|
return `https://${match[49]}.upstreamcdn.co/hls/${match[148]}/master.m3u8`
|
||||||
@ -215,6 +216,22 @@ class Vupload implements Match {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Kwik implements Match {
|
||||||
|
name = 'Kwik'
|
||||||
|
id = 'kwik'
|
||||||
|
reliability = Reliability.HIGH
|
||||||
|
domains = [
|
||||||
|
'kwik.cx'
|
||||||
|
]
|
||||||
|
regex = new RegExp(/eval\(function\(p,a,c,k,e,d\).*?(?=\<\/script\>)/gms)
|
||||||
|
|
||||||
|
async match(match: RegExpMatchArray): Promise<string> {
|
||||||
|
let unpacked = unPack(match[0])
|
||||||
|
let url = unpacked.match(/(?<=source=').*(?=')/)[0]
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const matches = [
|
export const matches = [
|
||||||
new Doodstream(),
|
new Doodstream(),
|
||||||
new Filemoon(),
|
new Filemoon(),
|
||||||
@ -226,5 +243,6 @@ export const matches = [
|
|||||||
new Upstream(),
|
new Upstream(),
|
||||||
new Vidoza(),
|
new Vidoza(),
|
||||||
new Voe(),
|
new Voe(),
|
||||||
new Vupload()
|
new Vupload(),
|
||||||
|
new Kwik()
|
||||||
]
|
]
|
||||||
|
60
src/match/unpack.ts
Normal file
60
src/match/unpack.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
export const unPack = (packed: String): String => {
|
||||||
|
// Use eval() for the unPack script because else the `env` variable will not be in scope when the eval in the script is called
|
||||||
|
const scriptlet = String.raw`
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// Un pack the code from the /packer/ //
|
||||||
|
// By matthew@matthewfl.com //
|
||||||
|
// http://matthewfl.com/unPacker.html //
|
||||||
|
//////////////////////////////////////////
|
||||||
|
// version 1.2
|
||||||
|
|
||||||
|
|
||||||
|
(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) {
|
||||||
|
code = c;
|
||||||
|
},
|
||||||
|
window: {},
|
||||||
|
document: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
eval("with(env) {" + code + "}");
|
||||||
|
|
||||||
|
code = (code+"").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);
|
||||||
|
|
||||||
|
code = code.join("\n");
|
||||||
|
return code;
|
||||||
|
})(${'String.raw`'}` + packed + String.raw`${'`'})`
|
||||||
|
|
||||||
|
return eval(scriptlet);
|
||||||
|
}
|
Reference in New Issue
Block a user