7 Commits

6 changed files with 94 additions and 21 deletions

View File

@ -6,9 +6,31 @@ This addon replaces the video player from this sides with the native player buil
This has the advantage, that no advertising or popups are shown when trying to interact with the video (playing, skipping, ...) or some sites are showing them even if you do nothing. This has the advantage, that no advertising or popups are shown when trying to interact with the video (playing, skipping, ...) or some sites are showing them even if you do nothing.
Additionally this enables you to download the video by right-clicking it and just choose the download option. Additionally this enables you to download the video by right-clicking it and just choose the download option.
Supported streaming providers (for a complete list of all supported websites, see [here](SUPPORTED)): Supported streaming providers (for a complete list of all supported websites, see [here](SUPPORTED) or in [show all](#all-supported-websites) below):
- [streamtape.com](https://streamtape.com/) - [streamtape.com](https://streamtape.com)
- [vidoza.net](https://vidoza.net/) - [vivo.sx](https://vivo.sx)
- [voe.sx](https://voe.sx)
<details id="all-supported-websites">
<summary><b>Show all</b></summary>
<ul>
<li><a href="https://evoload.io">evoload.io</a></li>
<li><a href="https://mcloud.to">mcloud.to</a></li>
<li><a href="https://mixdrop.co">mixdrop.co</a></li>
<li><a href="https://streamtape.com">streamtape.com</a></li>
<li><a href="https://streamzz.to">streamzz.to</a></li>
<li><a href="https://thevideome.com">thevideome.com</a></li>
<li><a href="https://upstream.to">upstream.to</a></li>
<li><a href="https://vidlox.me">vidlox.me</a></li>
<li><a href="https://vidstream.pro">vidstream.pro</a></li>
<li><a href="https://vidoza.net">vidoza.net</a></li>
<li><a href="https://vivo.st">vivo.st</a></li>
<li><a href="https://vivo.sx">vivo.sx</a></li>
<li><a href="https://voe.sx">voe.sx</a></li>
<li><a href="https://vupload.com">vupload.com</a></li></ul>
</details>
---
<details id="example"> <details id="example">
<summary><b>How it's working</b></summary> <summary><b>How it's working</b></summary>
@ -16,9 +38,10 @@ Supported streaming providers (for a complete list of all supported websites, se
</details> </details>
The addon was tested on The addon was tested on
- Firefox (92.0) - Firefox (95.0b8)
- Chromium (92.0) - Ungoogled Chromium (94.0)
- Opera (78.0) - Vivaldi (4.3)
- Opera (81.0)
## Installing ## Installing

View File

@ -1,8 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
import argparse import argparse
import io
import json import json
import sys import sys
import urllib.request
import zipfile
from pathlib import Path from pathlib import Path
import re import re
import shutil import shutil
@ -35,13 +38,6 @@ def write_manifest():
for content_script in manifest['content_scripts']: for content_script in manifest['content_scripts']:
content_script['matches'] = [f'*://{match}/*' for match in matches] content_script['matches'] = [f'*://{match}/*' for match in matches]
domains = []
for match in matches:
toplevel = match.split('.')[-1]
if toplevel not in domains:
domains.append(toplevel)
manifest['content_security_policy'] = f"script-src 'self' blob: https://cdn.jsdelivr.net https://unpkg.com {' '.join(f'*.{toplevel}' for toplevel in domains)}; object-src 'self'"
json.dump(manifest, open('src/manifest.json', 'w'), indent=2) json.dump(manifest, open('src/manifest.json', 'w'), indent=2)
@ -49,6 +45,42 @@ def write_supported():
open('SUPPORTED', 'w').writelines([f'{match}\n' for match in load_matches()]) open('SUPPORTED', 'w').writelines([f'{match}\n' for match in load_matches()])
def write_readme():
firefox_pattern = re.compile(r'Mozilla Firefox (?P<version>.+)')
chromium_pattern = re.compile(r'(?P<version>\d+\.\d+)')
tested = {}
stdout, stderr = subprocess.Popen(['firefox', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if stderr == b'':
tested['Firefox'] = re.search(firefox_pattern, stdout.decode('utf-8').replace('\n', '')).group('version')
for command, name in {'chromium': 'Ungoogled Chromium', 'vivaldi-stable': 'Vivaldi', 'opera': 'Opera'}.items():
stdout, stderr = subprocess.Popen([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if stderr == b'':
tested[name] = re.search(chromium_pattern, stdout.decode('utf-8').replace('\n', '')).group('version')
# it this the right syntax if i want to read and write to a file? * dreams in python3.10 *
with open('README.md', 'r') as read_file:
readme = read_file.read()
# adds all available websites
all_providers_regex = r'(?<=<ul>\n)(.+?)(?=</ul>)'
domains = filter(lambda domain: domain != '', open('SUPPORTED', 'r').read().split('\n'))
all_providers = '\n'.join(f'\t\t<li><a href="https://{supported}">{supported}</a></li>' for supported in domains)
readme = re.sub(all_providers_regex, all_providers, readme, flags=re.DOTALL)
# adds all installed browsers to the tested browser section. i'm just to lazy to seek out all browser versions manually
tested_browsers_regex = r'(?<=The addon was tested on\n)(.+?)(?=\n*## Installing)'
tested_browsers = '\n'.join(f'- {name} ({version})' for name, version in tested.items())
readme = re.sub(tested_browsers_regex, tested_browsers, readme, flags=re.DOTALL)
# rewrite the readme
with open('README.md', 'w') as write_file:
write_file.write(readme)
write_file.close()
read_file.close()
def copy_built(): def copy_built():
if not shutil.which('tsc'): if not shutil.which('tsc'):
sys.stderr.write('The typescript compiler `tsc` could not be found') sys.stderr.write('The typescript compiler `tsc` could not be found')
@ -78,6 +110,21 @@ def copy_built():
elif file.suffix != '.ts': elif file.suffix != '.ts':
shutil.copy(str(file), str(build_file)) shutil.copy(str(file), str(build_file))
ext_path = Path('build', 'ext')
if not ext_path.is_dir():
ext_path.mkdir()
# download hls.js (version 1.1.1)
with zipfile.ZipFile(io.BytesIO(urllib.request.urlopen('https://github.com/video-dev/hls.js/releases/download/v1.1.1/release.zip').read())) as z:
open(ext_path.joinpath('hls.light.min.js'), 'wb').write(z.read('dist/hls.light.min.js'))
z.close()
# download popperjs core (version 2.10.2)
open(ext_path.joinpath('popper.min.js'), 'wb').write(urllib.request.urlopen('https://unpkg.com/@popperjs/core@2.10.2/dist/umd/popper.min.js').read())
# download tippy.js (version 6.3.7)
open(ext_path.joinpath('tippy-bundle.umd.min.js'), 'wb').write(urllib.request.urlopen('https://unpkg.com/tippy.js@6.3.7/dist/tippy-bundle.umd.min.js').read())
def clean_build(): def clean_build():
for file in Path('src').rglob('*'): for file in Path('src').rglob('*'):
@ -88,6 +135,7 @@ def clean_build():
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-m', '--manifest', action='store_true', help='Builds the manifest.json file for addon information in ./src') parser.add_argument('-m', '--manifest', action='store_true', help='Builds the manifest.json file for addon information in ./src')
parser.add_argument('-r', '--readme', action='store_true', help='Updates the README.md with the currently installed ')
parser.add_argument('-s', '--supported', action='store_true', help='Builds the SUPPORTED file with all supported domains in the current directory') parser.add_argument('-s', '--supported', action='store_true', help='Builds the SUPPORTED file with all supported domains in the current directory')
parser.add_argument('-b', '--build', action='store_true', help='Creates a ./build folder and builds all typescript / sass files') parser.add_argument('-b', '--build', action='store_true', help='Creates a ./build folder and builds all typescript / sass files')
parser.add_argument('-c', '--clean', action='store_true', help='Cleans the ./src folder from .js, .css and .map files') parser.add_argument('-c', '--clean', action='store_true', help='Cleans the ./src folder from .js, .css and .map files')
@ -96,6 +144,8 @@ if __name__ == '__main__':
if parsed.manifest: if parsed.manifest:
write_manifest() write_manifest()
if parsed.readme:
write_readme()
if parsed.supported: if parsed.supported:
write_supported() write_supported()
if parsed.build: if parsed.build:

View File

@ -2,8 +2,8 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Stream Bypass", "name": "Stream Bypass",
"author": "ByteDream", "author": "ByteDream",
"description": "", "description": "A multi-browser addon / extension for multiple streaming providers which redirects directly to the source video.",
"version": "1.2.0", "version": "1.4.0",
"homepage_url": "https://github.com/ByteDream/stream-bypass", "homepage_url": "https://github.com/ByteDream/stream-bypass",
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
@ -39,7 +39,7 @@
"permissions": [ "permissions": [
"storage" "storage"
], ],
"content_security_policy": "script-src 'self' blob: https://cdn.jsdelivr.net https://unpkg.com *.io *.to *.co *.com *.me *.pro *.net *.st *.sx; object-src 'self'", "content_security_policy": "script-src 'self' blob:; object-src 'self'",
"browser_action": { "browser_action": {
"default_icon": "icons/stream-bypass.png", "default_icon": "icons/stream-bypass.png",
"default_title": "Stream Bypass", "default_title": "Stream Bypass",

View File

@ -4,8 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Title</title> <title>Title</title>
<link rel="stylesheet" href="popup.css"> <link rel="stylesheet" href="popup.css">
<script src="https://unpkg.com/@popperjs/core@2"></script> <script src="../ext/popper.min.js"></script>
<script src="https://unpkg.com/tippy.js@6"></script> <script src="../ext/tippy-bundle.umd.min.js"></script>
<script src="../match.js"></script> <script src="../match.js"></script>
</head> </head>
<body> <body>

View File

@ -3,11 +3,11 @@
<head> <head>
<title>m3u8</title> <title>m3u8</title>
<link rel="stylesheet" href="/res/hls.css"> <link rel="stylesheet" href="/res/hls.css">
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> <script src="/ext/hls.light.min.js"></script>
</head> </head>
<body> <body>
<video id="video"></video> <video id="video"></video>
<p id="message" hidden></p> <p id="message" hidden></p>
<script src="/res/hls.js"></script> <script src="/res/hls.light.min.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
function showMessage(message: string) { function showMessage(message: string) {
let messageElement = document.getElementById('message') as HTMLParagraphElement let messageElement = document.getElementById('message') as HTMLParagraphElement
messageElement.innerHTML = message messageElement.innerText = message
messageElement.hidden = false messageElement.hidden = false
document.getElementById('video').hidden = true document.getElementById('video').hidden = true
} }