From b45c1410f286f5e2ea4187405c516e7ab38255b6 Mon Sep 17 00:00:00 2001 From: bytedream Date: Mon, 13 Sep 2021 01:36:00 +0200 Subject: [PATCH] Added 7 new sites and general refactoring --- README.md | 2 +- SUPPORTED | 7 +++++++ build.py | 11 +++-------- src/index.ts | 28 ++++++++++++++++++++++++---- src/manifest.json | 9 ++++++++- src/match.ts | 43 +++++++++++++++++++++++++++++++++++++++---- 6 files changed, 82 insertions(+), 18 deletions(-) mode change 100755 => 100644 build.py diff --git a/README.md b/README.md index 7dd592a..a8f78c8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The addon was tested on ### Firefox -Install the `.xpi` (firefox addon) file from the [latest release](https://github.com/ByteDream/stream-bypass/releases/latest). +Install the addon directly from the [firefox addon store](https://addons.mozilla.org/de/firefox/addon/stream-bypass/). ### Chromium / Google Chrome diff --git a/SUPPORTED b/SUPPORTED index 5d29612..3b5cbee 100644 --- a/SUPPORTED +++ b/SUPPORTED @@ -1,4 +1,11 @@ +evoload.io +mixdrop.co streamtape.com +streamzz.to +thevideome.com +vidlox.me vidoza.net +vivo.st vivo.sx +voe.sx vupload.com diff --git a/build.py b/build.py old mode 100755 new mode 100644 index d8f338f..5a93d09 --- a/build.py +++ b/build.py @@ -55,18 +55,13 @@ def copy_built(): subprocess.call(['tsc', '-p', 'src']) build_path = Path('build') - if build_path.is_dir(): - for file in build_path.rglob('*'): - if file.is_dir(): - shutil.rmtree(str(file)) - else: - file.unlink() - else: + if not build_path.is_dir(): build_path.mkdir() for file in Path('src').rglob('*'): build_file = build_path.joinpath(str(file)[4:]) if file.is_dir(): - build_file.mkdir(parents=True) + if not build_file.exists(): + build_file.mkdir(parents=True) elif file.suffix == '.sass': css_file = str(file)[:-4] + 'css' subprocess.call(['sass', '--no-source-map', file, css_file]) diff --git a/src/index.ts b/src/index.ts index 77318e7..308d186 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,7 @@ +function hasSuffix(content: string, suffix: string) { + return content.indexOf(suffix, content.length - suffix.length) !== -1 +} + // @ts-ignore chrome.storage.local.get(['all', 'disabled'], function (result) { let keys = Object.keys(result) @@ -12,10 +16,26 @@ chrome.storage.local.get(['all', 'disabled'], function (result) { let matchClass = match[2] as Match let re - if (regex === null) { - location.assign(matchClass === null ? document.body.innerHTML : matchClass.match(new RegExp('').exec(document.body.innerHTML))) - } else if ((re = regex.exec(document.body.innerHTML)) !== null) { - location.assign(matchClass === null ? re[0] : matchClass.match(re)) + if (regex !== null) { + if ((re = document.body.innerHTML.match(regex)) === null) { + continue + } + } else { + re = document.body.innerHTML.match(regex) + } + + return + + if (matchClass === null) { + if (regex === null) { + location.assign(document.body.innerHTML) + } else { + location.assign(hasSuffix(re[0], 'm3u8') ? `https://bharadwajpro.github.io/m3u8-player/player/#${re[0]}`: re[0]) + } + } else { + matchClass.match(re).then(function (path) { + location.assign(hasSuffix(path, 'm3u8') ? `https://bharadwajpro.github.io/m3u8-player/player/#${path}`: path) + }) } } return diff --git a/src/manifest.json b/src/manifest.json index 43dd8f4..eecaa2a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -3,15 +3,22 @@ "name": "Stream Bypass", "author": "ByteDream", "description": "", - "version": "1.0.0", + "version": "1.1.0", "homepage_url": "https://github.com/ByteDream/stream-bypass", "content_scripts": [ { "all_frames": true, "matches": [ + "*://evoload.io/*", + "*://mixdrop.co/*", "*://streamtape.com/*", + "*://streamzz.to/*", + "*://thevideome.com/*", + "*://vidlox.me/*", "*://vidoza.net/*", + "*://vivo.st/*", "*://vivo.sx/*", + "*://voe.sx/*", "*://vupload.com/*" ], "js": [ diff --git a/src/match.ts b/src/match.ts index d93e314..c8dd999 100644 --- a/src/match.ts +++ b/src/match.ts @@ -1,15 +1,43 @@ interface Match { - match(match: RegExpMatchArray): string + match(match: RegExpMatchArray): Promise +} + +class Evoload implements Match { + async match(match: RegExpMatchArray): Promise { + const code = window.location.pathname.split('/').slice(-1)[0] + const response = await fetch('https://evoload.io/SecurePlayer', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({code: code}) + }) + + const json = await response.json() + return json['stream']['src'] + } +} + +class Mixdrop implements Match { + async match(match: RegExpMatchArray): Promise { + return `https://a-${match[1]}.${match[4]}.${match[5]}/v/${match[2]}.${match[6]}?s=${match[12]}&e=${match[13]}` + } } class Streamtape implements Match { - match(match: RegExpMatchArray): string { + async match(match: RegExpMatchArray): Promise { return `https://streamtape.com/get_video?${match[0]}` } } +class TheVideoMe implements Match { + async match(match: RegExpMatchArray): Promise { + return `https://thevideome.com/${match[5]}.mp4` + } +} + class Vivo implements Match { - match(match: RegExpMatchArray): string { + async match(match: RegExpMatchArray): Promise { return this.rot47(decodeURIComponent(match[1])) } @@ -29,15 +57,22 @@ class Vivo implements Match { } class Vupload implements Match { - match(match: RegExpMatchArray): string { + async match(match: RegExpMatchArray): Promise { return `https://www3.megaupload.to/${match[0]}/v.mp4` } } // every match HAS to be on an separate line const matches = [ + ['evoload.io', null, new Evoload()], + ['mixdrop.co', new RegExp(/(?<=\|)\w{2,}/gm), new Mixdrop()], ['streamtape.com', new RegExp(/id=\S*(?=')/gm), new Streamtape()], + ['streamzz.to', new RegExp(/https?:\/\/get.streamz.tw\/getlink-\w+\.dll/gm), null], + ['thevideome.com', new RegExp(/(?<=\|)\w{2,}/gm), new TheVideoMe()], + ['vidlox.me', new RegExp(/(?<=\[")\S+?(?=")/gm), null], ['vidoza.net', new RegExp(/(?<=src:(\s*)?")\S*(?=")/gm), null], + ['vivo.st', new RegExp(/source:\s*'(\S+)'/gm), new Vivo()], ['vivo.sx', new RegExp(/source:\s*'(\S+)'/gm), new Vivo()], + ['voe.sx', new RegExp(/https?:\/\/\S*m3u8(?=")/gm), null], ['vupload.com', new RegExp(/(?<=class\|)\w*/gm), new Vupload()] ]