Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c256a045f9 | ||
|
|
98603439cb | ||
|
|
a6ca011202 | ||
|
|
114c2572a4 | ||
|
f64b362603
|
|||
|
2fd7910194
|
|||
|
c2e53072f7
|
|||
|
c2986f3b14
|
|||
|
57854169f4
|
|||
|
3217305f9f
|
|||
|
639aadd2c1
|
|||
|
7157df13cd
|
|||
|
630e0137e0
|
|||
|
a0c51731af
|
|||
|
d361996fc0
|
|||
|
|
4ef7dda14a | ||
|
|
ee31cedae0 | ||
|
d3b0cb5e13
|
|||
|
0a79974d11
|
|||
|
4e327944a0
|
|||
|
09a437f7fb
|
|||
|
3cbe18aac0
|
|||
|
|
62418f8e95 | ||
|
bfd3760969
|
|||
|
efd89b2e64
|
|||
|
0dc1747178
|
|||
|
8577164785
|
|||
|
8af98968dd
|
|||
|
8f00cbcdd6
|
|||
|
af75551bc2
|
|||
|
3a6cc1e44f
|
|||
|
7664b5f0ff
|
|||
|
ec5d236cad
|
|||
|
d6b7a255d0
|
|||
|
22bc7324db
|
|||
|
48e8f271e7
|
|||
|
9a0ad6070b
|
|||
|
6039589f24
|
|||
|
d4cba7eb6c
|
|||
|
70cb453280
|
|||
|
7a106331e7
|
|||
|
8775e131af
|
|||
|
1f16f7cb62
|
|||
|
80b7f3cd00
|
|||
|
8b79e067bc
|
|||
|
cda0627d5a
|
|||
|
ad40dd6d6b
|
|||
|
b91d53dc6f
|
|||
|
cda4fd1f26
|
|||
|
ff2a2edaa5
|
|||
|
38d8d5d4c5
|
|||
|
f010452abf
|
23
.gitea/workflows/ci.yaml
Normal file
23
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.11
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: pytest
|
||||||
40
.gitea/workflows/git-sync.yaml
Normal file
40
.gitea/workflows/git-sync.yaml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: git-sync-with-mirror
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
git-sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: git-sync
|
||||||
|
env:
|
||||||
|
git_sync_source_repo: git@git.fridu.us:heckyel/yt-local.git
|
||||||
|
git_sync_destination_repo: ssh://git@c.fridu.us/software/yt-local.git
|
||||||
|
if: env.git_sync_source_repo && env.git_sync_destination_repo
|
||||||
|
uses: astounds/git-sync@v1
|
||||||
|
with:
|
||||||
|
source_repo: git@git.fridu.us:heckyel/yt-local.git
|
||||||
|
source_branch: "master"
|
||||||
|
destination_repo: ssh://git@c.fridu.us/software/yt-local.git
|
||||||
|
destination_branch: "master"
|
||||||
|
source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
|
||||||
|
destination_ssh_private_key: ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
- name: git-sync-sourcehut
|
||||||
|
env:
|
||||||
|
git_sync_source_repo: git@git.fridu.us:heckyel/yt-local.git
|
||||||
|
git_sync_destination_repo: git@git.sr.ht:~heckyel/yt-local
|
||||||
|
if: env.git_sync_source_repo && env.git_sync_destination_repo
|
||||||
|
uses: astounds/git-sync@v1
|
||||||
|
with:
|
||||||
|
source_repo: git@git.fridu.us:heckyel/yt-local.git
|
||||||
|
source_branch: "master"
|
||||||
|
destination_repo: git@git.sr.ht:~heckyel/yt-local
|
||||||
|
destination_branch: "master"
|
||||||
|
source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
|
||||||
|
destination_ssh_private_key: ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}
|
||||||
|
continue-on-error: true
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
[](https://drone.hgit.ga/heckyel/yt-local)
|
|
||||||
|
|
||||||
# yt-local
|
# yt-local
|
||||||
|
|
||||||
Fork of [youtube-local](https://github.com/user234683/youtube-local)
|
Fork of [youtube-local](https://github.com/user234683/youtube-local)
|
||||||
@@ -153,7 +151,7 @@ For coding guidelines and an overview of the software architecture, see the [HAC
|
|||||||
|
|
||||||
yt-local is not made to work in public mode, however there is an instance of yt-local in public mode but with less features
|
yt-local is not made to work in public mode, however there is an instance of yt-local in public mode but with less features
|
||||||
|
|
||||||
- <https://1cd1-93-95-230-133.ngrok-free.app/https://youtube.com>
|
- <https://m.fridu.us/https://youtube.com>
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -114,10 +114,12 @@ if bitness == '32':
|
|||||||
visual_c_runtime_url = 'https://github.com/yuempek/vc-archive/raw/master/archives/vc15_(14.10.25017.0)_2017_x86.7z'
|
visual_c_runtime_url = 'https://github.com/yuempek/vc-archive/raw/master/archives/vc15_(14.10.25017.0)_2017_x86.7z'
|
||||||
visual_c_runtime_sha256 = '2549eb4d2ce4cf3a87425ea01940f74368bf1cda378ef8a8a1f1a12ed59f1547'
|
visual_c_runtime_sha256 = '2549eb4d2ce4cf3a87425ea01940f74368bf1cda378ef8a8a1f1a12ed59f1547'
|
||||||
visual_c_name = 'vc15_(14.10.25017.0)_2017_x86.7z'
|
visual_c_name = 'vc15_(14.10.25017.0)_2017_x86.7z'
|
||||||
|
visual_c_path_to_dlls = 'runtime_minimum/System'
|
||||||
else:
|
else:
|
||||||
visual_c_runtime_url = 'https://github.com/yuempek/vc-archive/raw/master/archives/vc15_(14.10.25017.0)_2017_x64.7z'
|
visual_c_runtime_url = 'https://github.com/yuempek/vc-archive/raw/master/archives/vc15_(14.10.25017.0)_2017_x64.7z'
|
||||||
visual_c_runtime_sha256 = '4f00b824c37e1017a93fccbd5775e6ee54f824b6786f5730d257a87a3d9ce921'
|
visual_c_runtime_sha256 = '4f00b824c37e1017a93fccbd5775e6ee54f824b6786f5730d257a87a3d9ce921'
|
||||||
visual_c_name = 'vc15_(14.10.25017.0)_2017_x64.7z'
|
visual_c_name = 'vc15_(14.10.25017.0)_2017_x64.7z'
|
||||||
|
visual_c_path_to_dlls = 'runtime_minimum/System64'
|
||||||
|
|
||||||
download_if_not_exists('get-pip.py', get_pip_url)
|
download_if_not_exists('get-pip.py', get_pip_url)
|
||||||
|
|
||||||
@@ -198,7 +200,7 @@ with open('./python/python3' + major_release + '._pth', 'a', encoding='utf-8') a
|
|||||||
f.write('..\n')'''
|
f.write('..\n')'''
|
||||||
|
|
||||||
log('Inserting Microsoft C Runtime')
|
log('Inserting Microsoft C Runtime')
|
||||||
check_subp(subprocess.run([r'7z', '-y', 'e', '-opython', 'vc15_(14.10.25017.0)_2017_x86.7z', 'runtime_minimum/System']))
|
check_subp(subprocess.run([r'7z', '-y', 'e', '-opython', visual_c_name, visual_c_path_to_dlls]))
|
||||||
|
|
||||||
log('Installing dependencies')
|
log('Installing dependencies')
|
||||||
wine_run(['./python/python.exe', '-I', '-m', 'pip', 'install', '--no-compile', '-r', './requirements.txt'])
|
wine_run(['./python/python.exe', '-I', '-m', 'pip', 'install', '--no-compile', '-r', './requirements.txt'])
|
||||||
|
|||||||
@@ -1,28 +1,5 @@
|
|||||||
attrs==22.1.0
|
# Include all production requirements
|
||||||
Brotli==1.0.9
|
-r requirements.txt
|
||||||
cachetools==4.2.4
|
|
||||||
click==8.0.4
|
# Development requirements
|
||||||
dataclasses==0.6
|
pytest>=6.2.1
|
||||||
defusedxml==0.7.1
|
|
||||||
Flask==2.0.1
|
|
||||||
gevent==22.10.2
|
|
||||||
greenlet==2.0.1
|
|
||||||
importlib-metadata==4.6.4
|
|
||||||
iniconfig==1.1.1
|
|
||||||
itsdangerous==2.0.1
|
|
||||||
Jinja2==3.0.3
|
|
||||||
MarkupSafe==2.0.1
|
|
||||||
packaging==20.9
|
|
||||||
pluggy>=0.13.1
|
|
||||||
py==1.10.0
|
|
||||||
pyparsing==2.4.7
|
|
||||||
PySocks==1.7.1
|
|
||||||
pytest==6.2.5
|
|
||||||
stem==1.8.0
|
|
||||||
toml==0.10.2
|
|
||||||
typing-extensions==3.10.0.2
|
|
||||||
urllib3==1.26.11
|
|
||||||
Werkzeug==2.1.1
|
|
||||||
zipp==3.5.1
|
|
||||||
zope.event==4.5.0
|
|
||||||
zope.interface==5.4.0
|
|
||||||
|
|||||||
@@ -1,20 +1,8 @@
|
|||||||
Brotli==1.0.9
|
Flask>=1.0.3
|
||||||
cachetools==4.2.4
|
gevent>=1.2.2
|
||||||
click==8.0.4
|
Brotli>=1.0.7
|
||||||
dataclasses==0.6
|
PySocks>=1.6.8
|
||||||
defusedxml==0.7.1
|
urllib3>=1.24.1
|
||||||
Flask==2.0.1
|
defusedxml>=0.5.0
|
||||||
gevent==22.10.2
|
cachetools>=4.0.0
|
||||||
greenlet==2.0.1
|
stem>=1.8.0
|
||||||
importlib-metadata==4.6.4
|
|
||||||
itsdangerous==2.0.1
|
|
||||||
Jinja2==3.0.3
|
|
||||||
MarkupSafe==2.0.1
|
|
||||||
PySocks==1.7.1
|
|
||||||
stem==1.8.0
|
|
||||||
typing-extensions==3.10.0.2
|
|
||||||
urllib3==1.26.11
|
|
||||||
Werkzeug==2.1.1
|
|
||||||
zipp==3.5.1
|
|
||||||
zope.event==4.5.0
|
|
||||||
zope.interface==5.4.0
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ def proxy_site(env, start_response, video=False):
|
|||||||
else:
|
else:
|
||||||
response, cleanup_func = util.fetch_url_response(url, send_headers)
|
response, cleanup_func = util.fetch_url_response(url, send_headers)
|
||||||
|
|
||||||
response_headers = response.getheaders()
|
response_headers = response.headers
|
||||||
if isinstance(response_headers, urllib3._collections.HTTPHeaderDict):
|
if isinstance(response_headers, urllib3._collections.HTTPHeaderDict):
|
||||||
response_headers = response_headers.items()
|
response_headers = response_headers.items()
|
||||||
if video:
|
if video:
|
||||||
|
|||||||
18
settings.py
18
settings.py
@@ -322,13 +322,6 @@ Archive: https://archive.ph/OZQbN''',
|
|||||||
'comment': '',
|
'comment': '',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
('gather_googlevideo_domains', {
|
|
||||||
'type': bool,
|
|
||||||
'default': False,
|
|
||||||
'comment': '''Developer use to debug 403s''',
|
|
||||||
'hidden': True,
|
|
||||||
}),
|
|
||||||
|
|
||||||
('debugging_save_responses', {
|
('debugging_save_responses', {
|
||||||
'type': bool,
|
'type': bool,
|
||||||
'default': False,
|
'default': False,
|
||||||
@@ -338,7 +331,7 @@ Archive: https://archive.ph/OZQbN''',
|
|||||||
|
|
||||||
('settings_version', {
|
('settings_version', {
|
||||||
'type': int,
|
'type': int,
|
||||||
'default': 5,
|
'default': 6,
|
||||||
'comment': '''Do not change, remove, or comment out this value, or else your settings may be lost or corrupted''',
|
'comment': '''Do not change, remove, or comment out this value, or else your settings may be lost or corrupted''',
|
||||||
'hidden': True,
|
'hidden': True,
|
||||||
}),
|
}),
|
||||||
@@ -419,11 +412,20 @@ def upgrade_to_5(settings_dict):
|
|||||||
return new_settings
|
return new_settings
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade_to_6(settings_dict):
|
||||||
|
new_settings = settings_dict.copy()
|
||||||
|
if 'gather_googlevideo_domains' in new_settings:
|
||||||
|
del new_settings['gather_googlevideo_domains']
|
||||||
|
new_settings['settings_version'] = 6
|
||||||
|
return new_settings
|
||||||
|
|
||||||
|
|
||||||
upgrade_functions = {
|
upgrade_functions = {
|
||||||
1: upgrade_to_2,
|
1: upgrade_to_2,
|
||||||
2: upgrade_to_3,
|
2: upgrade_to_3,
|
||||||
3: upgrade_to_4,
|
3: upgrade_to_4,
|
||||||
4: upgrade_to_5,
|
4: upgrade_to_5,
|
||||||
|
5: upgrade_to_6,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def error_page(e):
|
|||||||
elif (exc_info()[0] == util.FetchError
|
elif (exc_info()[0] == util.FetchError
|
||||||
and exc_info()[1].code == '404'
|
and exc_info()[1].code == '404'
|
||||||
):
|
):
|
||||||
error_message = ('Error: The page you are looking for isn\'t here. ¯\_(ツ)_/¯')
|
error_message = ('Error: The page you are looking for isn\'t here.')
|
||||||
return flask.render_template('error.html',
|
return flask.render_template('error.html',
|
||||||
error_code=exc_info()[1].code,
|
error_code=exc_info()[1].code,
|
||||||
error_message=error_message,
|
error_message=error_message,
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ def get_channel_tab(channel_id, page="1", sort=3, tab='videos', view=1,
|
|||||||
'hl': 'en',
|
'hl': 'en',
|
||||||
'gl': 'US',
|
'gl': 'US',
|
||||||
'clientName': 'WEB',
|
'clientName': 'WEB',
|
||||||
'clientVersion': '2.20180830',
|
'clientVersion': '2.20240327.00.00',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'continuation': ctoken,
|
'continuation': ctoken,
|
||||||
@@ -292,7 +292,7 @@ def get_number_of_videos_channel(channel_id):
|
|||||||
try:
|
try:
|
||||||
response = util.fetch_url(url, headers_mobile,
|
response = util.fetch_url(url, headers_mobile,
|
||||||
debug_name='number_of_videos', report_text='Got number of videos')
|
debug_name='number_of_videos', report_text='Got number of videos')
|
||||||
except urllib.error.HTTPError as e:
|
except (urllib.error.HTTPError, util.FetchError) as e:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
print("Couldn't retrieve number of videos")
|
print("Couldn't retrieve number of videos")
|
||||||
return 1000
|
return 1000
|
||||||
@@ -371,7 +371,7 @@ def get_channel_search_json(channel_id, query, page):
|
|||||||
'hl': 'en',
|
'hl': 'en',
|
||||||
'gl': 'US',
|
'gl': 'US',
|
||||||
'clientName': 'WEB',
|
'clientName': 'WEB',
|
||||||
'clientVersion': '2.20180830',
|
'clientVersion': '2.20240327.00.00',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'continuation': ctoken,
|
'continuation': ctoken,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def request_comments(ctoken, replies=False):
|
|||||||
'hl': 'en',
|
'hl': 'en',
|
||||||
'gl': 'US',
|
'gl': 'US',
|
||||||
'clientName': 'MWEB',
|
'clientName': 'MWEB',
|
||||||
'clientVersion': '2.20210804.02.00',
|
'clientVersion': '2.20240328.08.00',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'continuation': ctoken.replace('=', '%3D'),
|
'continuation': ctoken.replace('=', '%3D'),
|
||||||
|
|||||||
@@ -11,17 +11,10 @@ import subprocess
|
|||||||
def app_version():
|
def app_version():
|
||||||
def minimal_env_cmd(cmd):
|
def minimal_env_cmd(cmd):
|
||||||
# make minimal environment
|
# make minimal environment
|
||||||
env = {}
|
env = {k: os.environ[k] for k in ['SYSTEMROOT', 'PATH'] if k in os.environ}
|
||||||
for k in ['SYSTEMROOT', 'PATH']:
|
env.update({'LANGUAGE': 'C', 'LANG': 'C', 'LC_ALL': 'C'})
|
||||||
v = os.environ.get(k)
|
|
||||||
if v is not None:
|
|
||||||
env[k] = v
|
|
||||||
|
|
||||||
env['LANGUAGE'] = 'C'
|
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
|
||||||
env['LANG'] = 'C'
|
|
||||||
env['LC_ALL'] = 'C'
|
|
||||||
out = subprocess.Popen(
|
|
||||||
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
subst_list = {
|
subst_list = {
|
||||||
@@ -31,24 +24,21 @@ def app_version():
|
|||||||
}
|
}
|
||||||
|
|
||||||
if os.system("command -v git > /dev/null 2>&1") != 0:
|
if os.system("command -v git > /dev/null 2>&1") != 0:
|
||||||
subst_list
|
return subst_list
|
||||||
else:
|
|
||||||
if call(["git", "branch"], stderr=STDOUT,
|
|
||||||
stdout=open(os.devnull, 'w')) != 0:
|
|
||||||
subst_list
|
|
||||||
else:
|
|
||||||
# version
|
|
||||||
describe = minimal_env_cmd(["git", "describe", "--always"])
|
|
||||||
git_revision = describe.strip().decode('ascii')
|
|
||||||
# branch
|
|
||||||
branch = minimal_env_cmd(["git", "branch"])
|
|
||||||
git_branch = branch.strip().decode('ascii').replace('* ', '')
|
|
||||||
|
|
||||||
subst_list = {
|
if call(["git", "branch"], stderr=STDOUT, stdout=open(os.devnull, 'w')) != 0:
|
||||||
"version": __version__,
|
return subst_list
|
||||||
"branch": git_branch,
|
|
||||||
"commit": git_revision
|
describe = minimal_env_cmd(["git", "describe", "--tags", "--always"])
|
||||||
}
|
git_revision = describe.strip().decode('ascii')
|
||||||
|
|
||||||
|
branch = minimal_env_cmd(["git", "branch"])
|
||||||
|
git_branch = branch.strip().decode('ascii').replace('* ', '')
|
||||||
|
|
||||||
|
subst_list.update({
|
||||||
|
"branch": git_branch,
|
||||||
|
"commit": git_revision
|
||||||
|
})
|
||||||
|
|
||||||
return subst_list
|
return subst_list
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ def get_playlist_page():
|
|||||||
|
|
||||||
video_count = yt_data_extract.deep_get(info, 'metadata', 'video_count')
|
video_count = yt_data_extract.deep_get(info, 'metadata', 'video_count')
|
||||||
if video_count is None:
|
if video_count is None:
|
||||||
video_count = 40
|
video_count = 1000
|
||||||
|
|
||||||
return flask.render_template(
|
return flask.render_template(
|
||||||
'playlist.html',
|
'playlist.html',
|
||||||
|
|||||||
@@ -256,7 +256,8 @@ hr {
|
|||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border: none;
|
border: 1px solid;
|
||||||
|
border-color: var(--button-border);
|
||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
:root {
|
:root {
|
||||||
--background: #212121;
|
--background: #121113;
|
||||||
--text: #FFFFFF;
|
--text: #FFFFFF;
|
||||||
--secondary-hover: #73828c;
|
--secondary-hover: #222222;
|
||||||
--secondary-focus: #303030;
|
--secondary-focus: #121113;
|
||||||
--secondary-inverse: #FFF;
|
--secondary-inverse: #FFFFFF;
|
||||||
--primary-background: #242424;
|
--primary-background: #242424;
|
||||||
--secondary-background: #424242;
|
--secondary-background: #222222;
|
||||||
--thumb-background: #757575;
|
--thumb-background: #222222;
|
||||||
--link: #00B0FF;
|
--link: #00B0FF;
|
||||||
--link-visited: #40C4FF;
|
--link-visited: #40C4FF;
|
||||||
--border-bg: #FFFFFF;
|
--border-bg: #222222;
|
||||||
--buttom: #dcdcdb;
|
--border-bg-settings: #000000;
|
||||||
--buttom-text: #415462;
|
--border-bg-license: #000000;
|
||||||
--button-border: #91918c;
|
--buttom: #121113;
|
||||||
--buttom-hover: #BBB;
|
--buttom-text: #FFFFFF;
|
||||||
--search-text: #FFF;
|
--button-border: #222222;
|
||||||
--time-background: #212121;
|
--buttom-hover: #222222;
|
||||||
--time-text: #FFF;
|
--search-text: #FFFFFF;
|
||||||
|
--time-background: #121113;
|
||||||
|
--time-text: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
:root {
|
:root {
|
||||||
--background: #2d3743;
|
--background: #2D3743;
|
||||||
--text: #FFFFFF;
|
--text: #FFFFFF;
|
||||||
--secondary-hover: #73828c;
|
--secondary-hover: #73828C;
|
||||||
--secondary-focus: rgba(115, 130, 140, 0.125);
|
--secondary-focus: rgba(115, 130, 140, 0.125);
|
||||||
--secondary-inverse: #FFFFFF;
|
--secondary-inverse: #FFFFFF;
|
||||||
--primary-background: #2d3743;
|
--primary-background: #2D3743;
|
||||||
--secondary-background: #102027;
|
--secondary-background: #102027;
|
||||||
--thumb-background: #35404D;
|
--thumb-background: #35404D;
|
||||||
--link: #22aaff;
|
--link: #22AAFF;
|
||||||
--link-visited: #7755ff;
|
--link-visited: #7755FF;
|
||||||
--border-bg: #FFFFFF;
|
--border-bg: #FFFFFF;
|
||||||
--buttom: #DCDCDC;
|
--border-bg-settings: #FFFFFF;
|
||||||
--buttom-text: #415462;
|
--border-bg-license: #FFFFFF;
|
||||||
--button-border: #91918c;
|
--buttom: #2D3743;
|
||||||
--buttom-hover: #BBBBBB;
|
--buttom-text: #FFFFFF;
|
||||||
|
--button-border: #102027;
|
||||||
|
--buttom-hover: #102027;
|
||||||
--search-text: #FFFFFF;
|
--search-text: #FFFFFF;
|
||||||
--time-background: #212121;
|
--time-background: #212121;
|
||||||
--time-text: #FFFFFF;
|
--time-text: #FFFFFF;
|
||||||
|
|||||||
@@ -20,6 +20,29 @@
|
|||||||
// TODO: Call abort to cancel in-progress appends?
|
// TODO: Call abort to cancel in-progress appends?
|
||||||
|
|
||||||
|
|
||||||
|
// Buffer sizes for different systems
|
||||||
|
const BUFFER_CONFIG = {
|
||||||
|
default: 50 * 10**6, // 50 megabytes
|
||||||
|
webOS: 20 * 10**6, // 20 megabytes WebOS (LG)
|
||||||
|
samsungTizen: 20 * 10**6, // 20 megabytes Samsung Tizen OS
|
||||||
|
androidTV: 30 * 10**6, // 30 megabytes Android TV
|
||||||
|
desktop: 50 * 10**6, // 50 megabytes PC/Mac
|
||||||
|
};
|
||||||
|
|
||||||
|
function detectSystem() {
|
||||||
|
const userAgent = navigator.userAgent.toLowerCase();
|
||||||
|
if (/webos|lg browser/i.test(userAgent)) {
|
||||||
|
return "webOS";
|
||||||
|
} else if (/tizen/i.test(userAgent)) {
|
||||||
|
return "samsungTizen";
|
||||||
|
} else if (/android tv|smart-tv/i.test(userAgent)) {
|
||||||
|
return "androidTV";
|
||||||
|
} else if (/firefox|chrome|safari|edge/i.test(userAgent)) {
|
||||||
|
return "desktop";
|
||||||
|
} else {
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function AVMerge(video, srcInfo, startTime){
|
function AVMerge(video, srcInfo, startTime){
|
||||||
this.audioSource = null;
|
this.audioSource = null;
|
||||||
@@ -164,6 +187,8 @@ AVMerge.prototype.printDebuggingInfo = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Stream(avMerge, source, startTime, avRatio) {
|
function Stream(avMerge, source, startTime, avRatio) {
|
||||||
|
const selectedSystem = detectSystem();
|
||||||
|
let baseBufferTarget = BUFFER_CONFIG[selectedSystem] || BUFFER_CONFIG.default;
|
||||||
this.avMerge = avMerge;
|
this.avMerge = avMerge;
|
||||||
this.video = avMerge.video;
|
this.video = avMerge.video;
|
||||||
this.url = source['url'];
|
this.url = source['url'];
|
||||||
@@ -173,10 +198,11 @@ function Stream(avMerge, source, startTime, avRatio) {
|
|||||||
this.mimeCodec = source['mime_codec']
|
this.mimeCodec = source['mime_codec']
|
||||||
this.streamType = source['acodec'] ? 'audio' : 'video';
|
this.streamType = source['acodec'] ? 'audio' : 'video';
|
||||||
if (this.streamType == 'audio') {
|
if (this.streamType == 'audio') {
|
||||||
this.bufferTarget = avRatio*50*10**6;
|
this.bufferTarget = avRatio * baseBufferTarget;
|
||||||
} else {
|
} else {
|
||||||
this.bufferTarget = 50*10**6; // 50 megabytes
|
this.bufferTarget = baseBufferTarget;
|
||||||
}
|
}
|
||||||
|
console.info(`Detected system: ${selectedSystem}. Applying bufferTarget of ${this.bufferTarget} bytes to ${this.streamType}.`);
|
||||||
|
|
||||||
this.initRange = source['init_range'];
|
this.initRange = source['init_range'];
|
||||||
this.indexRange = source['index_range'];
|
this.indexRange = source['index_range'];
|
||||||
@@ -569,7 +595,8 @@ function fetchRange(url, start, end, debugInfo) {
|
|||||||
onFailure(e, 'Network error');
|
onFailure(e, 'Network error');
|
||||||
};
|
};
|
||||||
xhr.ontimeout = function (event){
|
xhr.ontimeout = function (event){
|
||||||
onFailure(null, 'Timeout (15s)', maxRetries=1);
|
xhr.timeout += 5000;
|
||||||
|
onFailure(null, 'Timeout (15s)', maxRetries=5);
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const player = new Plyr(document.getElementById('js-video-player'), {
|
const playerOptions = {
|
||||||
// Learning about autoplay permission https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/autoplay#syntax
|
// Learning about autoplay permission https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/autoplay#syntax
|
||||||
autoplay: autoplayActive,
|
autoplay: autoplayActive,
|
||||||
disableContextMenu: false,
|
disableContextMenu: false,
|
||||||
@@ -117,5 +117,20 @@
|
|||||||
tooltips: {
|
tooltips: {
|
||||||
controls: true,
|
controls: true,
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const player = new Plyr(document.getElementById('js-video-player'), playerOptions);
|
||||||
|
|
||||||
|
// disable double click to fullscreen
|
||||||
|
// https://github.com/sampotts/plyr/issues/1370#issuecomment-528966795
|
||||||
|
player.eventListeners.forEach(function(eventListener) {
|
||||||
|
if(eventListener.type === 'dblclick') {
|
||||||
|
eventListener.element.removeEventListener(eventListener.type, eventListener.callback, eventListener.options);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add .started property, true after the playback has been started
|
||||||
|
// Needed so controls won't be hidden before playback has started
|
||||||
|
player.started = false;
|
||||||
|
player.once('playing', function(){this.started = true});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ label[for=options-toggle-cbox] {
|
|||||||
|
|
||||||
.table td,.table th {
|
.table td,.table th {
|
||||||
padding: 10px 10px;
|
padding: 10px 10px;
|
||||||
border: 1px solid var(--secondary-background);
|
border: 1px solid var(--border-bg-license);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,11 @@
|
|||||||
--link: #212121;
|
--link: #212121;
|
||||||
--link-visited: #808080;
|
--link-visited: #808080;
|
||||||
--border-bg: #212121;
|
--border-bg: #212121;
|
||||||
--buttom: #DCDCDC;
|
--border-bg-settings: #91918C;
|
||||||
|
--border-bg-license: #91918C;
|
||||||
|
--buttom: #FFFFFF;
|
||||||
--buttom-text: #212121;
|
--buttom-text: #212121;
|
||||||
--button-border: #91918c;
|
--button-border: #91918C;
|
||||||
--buttom-hover: #BBBBBB;
|
--buttom-hover: #BBBBBB;
|
||||||
--search-text: #212121;
|
--search-text: #212121;
|
||||||
--time-background: #212121;
|
--time-background: #212121;
|
||||||
|
|||||||
@@ -37,3 +37,41 @@ e.g. Firefox playback speed options */
|
|||||||
max-height: 320px;
|
max-height: 320px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Custom styles similar to youtube
|
||||||
|
*/
|
||||||
|
.plyr__controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plyr__progress__container {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plyr__controls .plyr__controls__item:first-child {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plyr__controls .plyr__controls__item.plyr__volume {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plyr__controls .plyr__controls__item.plyr__progress__container {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plyr__progress input[type="range"] {
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* End custom styles
|
||||||
|
*/
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ label[for=options-toggle-cbox] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.settings-form > h2 {
|
.settings-form > h2 {
|
||||||
border-bottom: 2px solid var(--border-bg);
|
border-bottom: 2px solid var(--border-bg-settings);
|
||||||
padding-bottom: 0.5rem;
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
110
youtube/util.py
110
youtube/util.py
@@ -318,10 +318,11 @@ def fetch_url(url, headers=(), timeout=15, report_text=None, data=None,
|
|||||||
cleanup_func(response) # release_connection for urllib3
|
cleanup_func(response) # release_connection for urllib3
|
||||||
content = decode_content(
|
content = decode_content(
|
||||||
content,
|
content,
|
||||||
response.getheader('Content-Encoding', default='identity'))
|
response.headers.get('Content-Encoding', default='identity'))
|
||||||
|
|
||||||
if (settings.debugging_save_responses
|
if (settings.debugging_save_responses
|
||||||
and debug_name is not None and content):
|
and debug_name is not None
|
||||||
|
and content):
|
||||||
save_dir = os.path.join(settings.data_dir, 'debug')
|
save_dir = os.path.join(settings.data_dir, 'debug')
|
||||||
if not os.path.exists(save_dir):
|
if not os.path.exists(save_dir):
|
||||||
os.makedirs(save_dir)
|
os.makedirs(save_dir)
|
||||||
@@ -336,7 +337,7 @@ def fetch_url(url, headers=(), timeout=15, report_text=None, data=None,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
print(response.status, response.reason, response.getheaders())
|
print(response.status, response.reason, response.headers)
|
||||||
ip = re.search(
|
ip = re.search(
|
||||||
br'IP address: ((?:[\da-f]*:)+[\da-f]+|(?:\d+\.)+\d+)',
|
br'IP address: ((?:[\da-f]*:)+[\da-f]+|(?:\d+\.)+\d+)',
|
||||||
content)
|
content)
|
||||||
@@ -394,7 +395,6 @@ def head(url, use_tor=False, report_text=None, max_redirects=10):
|
|||||||
round(time.monotonic() - start_time, 3))
|
round(time.monotonic() - start_time, 3))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
mobile_user_agent = 'Mozilla/5.0 (Linux; Android 7.0; Redmi Note 4 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36'
|
mobile_user_agent = 'Mozilla/5.0 (Linux; Android 7.0; Redmi Note 4 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36'
|
||||||
mobile_ua = (('User-Agent', mobile_user_agent),)
|
mobile_ua = (('User-Agent', mobile_user_agent),)
|
||||||
desktop_user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0'
|
desktop_user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0'
|
||||||
@@ -404,13 +404,13 @@ desktop_xhr_headers = (
|
|||||||
('Accept', '*/*'),
|
('Accept', '*/*'),
|
||||||
('Accept-Language', 'en-US,en;q=0.5'),
|
('Accept-Language', 'en-US,en;q=0.5'),
|
||||||
('X-YouTube-Client-Name', '1'),
|
('X-YouTube-Client-Name', '1'),
|
||||||
('X-YouTube-Client-Version', '2.20180830'),
|
('X-YouTube-Client-Version', '2.20240304.00.00'),
|
||||||
) + desktop_ua
|
) + desktop_ua
|
||||||
mobile_xhr_headers = (
|
mobile_xhr_headers = (
|
||||||
('Accept', '*/*'),
|
('Accept', '*/*'),
|
||||||
('Accept-Language', 'en-US,en;q=0.5'),
|
('Accept-Language', 'en-US,en;q=0.5'),
|
||||||
('X-YouTube-Client-Name', '2'),
|
('X-YouTube-Client-Name', '2'),
|
||||||
('X-YouTube-Client-Version', '2.20180830'),
|
('X-YouTube-Client-Version', '2.20240304.08.00'),
|
||||||
) + mobile_ua
|
) + mobile_ua
|
||||||
|
|
||||||
|
|
||||||
@@ -674,11 +674,12 @@ INNERTUBE_CLIENTS = {
|
|||||||
'hl': 'en',
|
'hl': 'en',
|
||||||
'gl': 'US',
|
'gl': 'US',
|
||||||
'clientName': 'ANDROID',
|
'clientName': 'ANDROID',
|
||||||
'clientVersion': '17.31.35',
|
'clientVersion': '19.09.36',
|
||||||
'osName': 'Android',
|
'osName': 'Android',
|
||||||
'osVersion': '12',
|
'osVersion': '12',
|
||||||
'androidSdkVersion': 31,
|
'androidSdkVersion': 31,
|
||||||
'userAgent': 'com.google.android.youtube/17.31.35 (Linux; U; Android 12) gzip'
|
'platform': 'MOBILE',
|
||||||
|
'userAgent': 'com.google.android.youtube/19.09.36 (Linux; U; Android 12; US) gzip'
|
||||||
},
|
},
|
||||||
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
|
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
|
||||||
#'thirdParty': {
|
#'thirdParty': {
|
||||||
@@ -689,6 +690,45 @@ INNERTUBE_CLIENTS = {
|
|||||||
'REQUIRE_JS_PLAYER': False,
|
'REQUIRE_JS_PLAYER': False,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'android-test-suite': {
|
||||||
|
'INNERTUBE_API_KEY': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w',
|
||||||
|
'INNERTUBE_CONTEXT': {
|
||||||
|
'client': {
|
||||||
|
'hl': 'en',
|
||||||
|
'gl': 'US',
|
||||||
|
'clientName': 'ANDROID_TESTSUITE',
|
||||||
|
'clientVersion': '1.9',
|
||||||
|
'osName': 'Android',
|
||||||
|
'osVersion': '12',
|
||||||
|
'androidSdkVersion': 31,
|
||||||
|
'platform': 'MOBILE',
|
||||||
|
'userAgent': 'com.google.android.youtube/1.9 (Linux; U; Android 12; US) gzip'
|
||||||
|
},
|
||||||
|
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
|
||||||
|
#'thirdParty': {
|
||||||
|
# 'embedUrl': 'https://google.com', # Can be any valid URL
|
||||||
|
#}
|
||||||
|
},
|
||||||
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 3,
|
||||||
|
'REQUIRE_JS_PLAYER': False,
|
||||||
|
},
|
||||||
|
|
||||||
|
'ios': {
|
||||||
|
'INNERTUBE_API_KEY': 'AIzaSyB-63vPrdThhKuerbB2N_l7Kwwcxj6yUAc',
|
||||||
|
'INNERTUBE_CONTEXT': {
|
||||||
|
'client': {
|
||||||
|
'hl': 'en',
|
||||||
|
'gl': 'US',
|
||||||
|
'clientName': 'IOS',
|
||||||
|
'clientVersion': '19.09.3',
|
||||||
|
'deviceModel': 'iPhone14,3',
|
||||||
|
'userAgent': 'com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 5,
|
||||||
|
'REQUIRE_JS_PLAYER': False
|
||||||
|
},
|
||||||
|
|
||||||
# This client can access age restricted videos (unless the uploader has disabled the 'allow embedding' option)
|
# This client can access age restricted videos (unless the uploader has disabled the 'allow embedding' option)
|
||||||
# See: https://github.com/zerodytrash/YouTube-Internal-Clients
|
# See: https://github.com/zerodytrash/YouTube-Internal-Clients
|
||||||
'tv_embedded': {
|
'tv_embedded': {
|
||||||
@@ -699,6 +739,7 @@ INNERTUBE_CLIENTS = {
|
|||||||
'gl': 'US',
|
'gl': 'US',
|
||||||
'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
|
'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
|
||||||
'clientVersion': '2.0',
|
'clientVersion': '2.0',
|
||||||
|
'clientScreen': 'EMBED',
|
||||||
},
|
},
|
||||||
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
|
# https://github.com/yt-dlp/yt-dlp/pull/575#issuecomment-887739287
|
||||||
'thirdParty': {
|
'thirdParty': {
|
||||||
@@ -721,8 +762,56 @@ INNERTUBE_CLIENTS = {
|
|||||||
},
|
},
|
||||||
'INNERTUBE_CONTEXT_CLIENT_NAME': 1
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 1
|
||||||
},
|
},
|
||||||
|
'android_vr': {
|
||||||
|
'INNERTUBE_API_KEY': 'AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w',
|
||||||
|
'INNERTUBE_CONTEXT': {
|
||||||
|
'client': {
|
||||||
|
'clientName': 'ANDROID_VR',
|
||||||
|
'clientVersion': '1.60.19',
|
||||||
|
'deviceMake': 'Oculus',
|
||||||
|
'deviceModel': 'Quest 3',
|
||||||
|
'androidSdkVersion': 32,
|
||||||
|
'userAgent': 'com.google.android.apps.youtube.vr.oculus/1.60.19 (Linux; U; Android 12L; eureka-user Build/SQ3A.220605.009.A1) gzip',
|
||||||
|
'osName': 'Android',
|
||||||
|
'osVersion': '12L',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'INNERTUBE_CONTEXT_CLIENT_NAME': 28,
|
||||||
|
'REQUIRE_JS_PLAYER': False,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_visitor_data():
|
||||||
|
visitor_data = None
|
||||||
|
visitor_data_cache = os.path.join(settings.data_dir, 'visitorData.txt')
|
||||||
|
if not os.path.exists(settings.data_dir):
|
||||||
|
os.makedirs(settings.data_dir)
|
||||||
|
if os.path.isfile(visitor_data_cache):
|
||||||
|
with open(visitor_data_cache, 'r') as file:
|
||||||
|
print('Getting visitor_data from cache')
|
||||||
|
visitor_data = file.read()
|
||||||
|
max_age = 12*3600
|
||||||
|
file_age = time.time() - os.path.getmtime(visitor_data_cache)
|
||||||
|
if file_age > max_age:
|
||||||
|
print('visitor_data cache is too old. Removing file...')
|
||||||
|
os.remove(visitor_data_cache)
|
||||||
|
return visitor_data
|
||||||
|
|
||||||
|
print('Fetching youtube homepage to get visitor_data')
|
||||||
|
yt_homepage = 'https://www.youtube.com'
|
||||||
|
yt_resp = fetch_url(yt_homepage, headers={'User-Agent': mobile_user_agent}, report_text='Getting youtube homepage')
|
||||||
|
visitor_data_re = r'''"visitorData":\s*?"(.+?)"'''
|
||||||
|
visitor_data_match = re.search(visitor_data_re, yt_resp.decode())
|
||||||
|
if visitor_data_match:
|
||||||
|
visitor_data = visitor_data_match.group(1)
|
||||||
|
print(f'Got visitor_data: {len(visitor_data)}')
|
||||||
|
with open(visitor_data_cache, 'w') as file:
|
||||||
|
print('Saving visitor_data cache...')
|
||||||
|
file.write(visitor_data)
|
||||||
|
return visitor_data
|
||||||
|
else:
|
||||||
|
print('Unable to get visitor_data value')
|
||||||
|
return visitor_data
|
||||||
|
|
||||||
def call_youtube_api(client, api, data):
|
def call_youtube_api(client, api, data):
|
||||||
client_params = INNERTUBE_CLIENTS[client]
|
client_params = INNERTUBE_CLIENTS[client]
|
||||||
@@ -730,12 +819,17 @@ def call_youtube_api(client, api, data):
|
|||||||
key = client_params['INNERTUBE_API_KEY']
|
key = client_params['INNERTUBE_API_KEY']
|
||||||
host = client_params.get('INNERTUBE_HOST') or 'www.youtube.com'
|
host = client_params.get('INNERTUBE_HOST') or 'www.youtube.com'
|
||||||
user_agent = context['client'].get('userAgent') or mobile_user_agent
|
user_agent = context['client'].get('userAgent') or mobile_user_agent
|
||||||
|
visitor_data = get_visitor_data()
|
||||||
|
|
||||||
url = 'https://' + host + '/youtubei/v1/' + api + '?key=' + key
|
url = 'https://' + host + '/youtubei/v1/' + api + '?key=' + key
|
||||||
|
if visitor_data:
|
||||||
|
context['client'].update({'visitorData': visitor_data})
|
||||||
data['context'] = context
|
data['context'] = context
|
||||||
|
|
||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
headers = (('Content-Type', 'application/json'),('User-Agent', user_agent))
|
headers = (('Content-Type', 'application/json'),('User-Agent', user_agent))
|
||||||
|
if visitor_data:
|
||||||
|
headers = ( *headers, ('X-Goog-Visitor-Id', visitor_data ))
|
||||||
response = fetch_url(
|
response = fetch_url(
|
||||||
url, data=data, headers=headers,
|
url, data=data, headers=headers,
|
||||||
debug_name='youtubei_' + api + '_' + client,
|
debug_name='youtubei_' + api + '_' + client,
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = '0.2.8'
|
__version__ = 'v0.3.1'
|
||||||
|
|||||||
@@ -343,7 +343,6 @@ def _add_to_error(info, key, additional_message):
|
|||||||
def fetch_player_response(client, video_id):
|
def fetch_player_response(client, video_id):
|
||||||
return util.call_youtube_api(client, 'player', {
|
return util.call_youtube_api(client, 'player', {
|
||||||
'videoId': video_id,
|
'videoId': video_id,
|
||||||
'params': 'CgIQBg',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -372,17 +371,7 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None):
|
|||||||
tasks = (
|
tasks = (
|
||||||
# Get video metadata from here
|
# Get video metadata from here
|
||||||
gevent.spawn(fetch_watch_page_info, video_id, playlist_id, index),
|
gevent.spawn(fetch_watch_page_info, video_id, playlist_id, index),
|
||||||
|
gevent.spawn(fetch_player_response, 'android_vr', video_id)
|
||||||
# Get video URLs by spoofing as android client because its urls don't
|
|
||||||
# require decryption
|
|
||||||
# The URLs returned with WEB for videos requiring decryption
|
|
||||||
# couldn't be decrypted with the base.js from the web page for some
|
|
||||||
# reason
|
|
||||||
# https://github.com/yt-dlp/yt-dlp/issues/574#issuecomment-887171136
|
|
||||||
|
|
||||||
# Update 4/26/23, these URLs will randomly start returning 403
|
|
||||||
# mid-playback and I'm not sure why
|
|
||||||
gevent.spawn(fetch_player_response, 'android', video_id)
|
|
||||||
)
|
)
|
||||||
gevent.joinall(tasks)
|
gevent.joinall(tasks)
|
||||||
util.check_gevent_exceptions(*tasks)
|
util.check_gevent_exceptions(*tasks)
|
||||||
@@ -660,12 +649,6 @@ def get_watch_page(video_id=None):
|
|||||||
'/videoplayback',
|
'/videoplayback',
|
||||||
'/videoplayback/name/' + filename)
|
'/videoplayback/name/' + filename)
|
||||||
|
|
||||||
if settings.gather_googlevideo_domains:
|
|
||||||
with open(os.path.join(settings.data_dir, 'googlevideo-domains.txt'), 'a+', encoding='utf-8') as f:
|
|
||||||
url = info['formats'][0]['url']
|
|
||||||
subdomain = url[0:url.find(".googlevideo.com")]
|
|
||||||
f.write(subdomain + "\n")
|
|
||||||
|
|
||||||
download_formats = []
|
download_formats = []
|
||||||
|
|
||||||
for format in (info['formats'] + info['hls_formats']):
|
for format in (info['formats'] + info['hls_formats']):
|
||||||
|
|||||||
Reference in New Issue
Block a user