mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[cleanup] Misc
This commit is contained in:
parent
fa44802809
commit
337734d4a8
@ -55,6 +55,7 @@ def commit_lookup(cls):
|
||||
'dependencies',
|
||||
'jsinterp',
|
||||
'outtmpl',
|
||||
'formats',
|
||||
'plugins',
|
||||
'update',
|
||||
'upstream',
|
||||
@ -68,9 +69,9 @@ def commit_lookup(cls):
|
||||
'misc',
|
||||
'test',
|
||||
},
|
||||
cls.EXTRACTOR: {'extractor'},
|
||||
cls.DOWNLOADER: {'downloader'},
|
||||
cls.POSTPROCESSOR: {'postprocessor'},
|
||||
cls.EXTRACTOR: {'extractor', 'ie'},
|
||||
cls.DOWNLOADER: {'downloader', 'fd'},
|
||||
cls.POSTPROCESSOR: {'postprocessor', 'pp'},
|
||||
}.items()
|
||||
for name in names
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ ignore = E402,E501,E731,E741,W503
|
||||
max_line_length = 120
|
||||
per_file_ignores =
|
||||
devscripts/lazy_load_template.py: F401
|
||||
yt_dlp/utils/__init__.py: F401, F403
|
||||
|
||||
|
||||
[autoflake]
|
||||
|
@ -3687,7 +3687,7 @@ def render_formats_table(self, info_dict):
|
||||
|
||||
def simplified_codec(f, field):
|
||||
assert field in ('acodec', 'vcodec')
|
||||
codec = f.get(field, 'unknown')
|
||||
codec = f.get(field)
|
||||
if not codec:
|
||||
return 'unknown'
|
||||
elif codec != 'none':
|
||||
|
@ -255,7 +255,8 @@ def sanitize_open(self, filename, open_mode):
|
||||
|
||||
@wrap_file_access('remove')
|
||||
def try_remove(self, filename):
|
||||
os.remove(filename)
|
||||
if os.path.isfile(filename):
|
||||
os.remove(filename)
|
||||
|
||||
@wrap_file_access('rename')
|
||||
def try_rename(self, old_filename, new_filename):
|
||||
|
@ -300,9 +300,7 @@ def frag_progress_hook(s):
|
||||
def _finish_frag_download(self, ctx, info_dict):
|
||||
ctx['dest_stream'].close()
|
||||
if self.__do_ytdl_file(ctx):
|
||||
ytdl_filename = encodeFilename(self.ytdl_filename(ctx['filename']))
|
||||
if os.path.isfile(ytdl_filename):
|
||||
self.try_remove(ytdl_filename)
|
||||
self.try_remove(self.ytdl_filename(ctx['filename']))
|
||||
elapsed = time.time() - ctx['started']
|
||||
|
||||
to_file = ctx['tmpfilename'] != '-'
|
||||
|
@ -1473,7 +1473,7 @@ def extract_redirect_url(html, url=None, fatal=False):
|
||||
elif 'automatically signed in with' in provider_redirect_page:
|
||||
# Seems like comcast is rolling up new way of automatically signing customers
|
||||
oauth_redirect_url = self._html_search_regex(
|
||||
r'continue:\s*"(https://oauth.xfinity.com/oauth/authorize\?.+)"', provider_redirect_page,
|
||||
r'continue:\s*"(https://oauth\.xfinity\.com/oauth/authorize\?.+)"', provider_redirect_page,
|
||||
'oauth redirect (signed)')
|
||||
# Just need to process the request. No useful data comes back
|
||||
self._download_webpage(oauth_redirect_url, video_id, 'Confirming auto login')
|
||||
|
@ -527,7 +527,7 @@ def _extract_vms_player_js(self, webpage, video_id):
|
||||
if player_js_cache:
|
||||
return player_js_cache
|
||||
webpack_js_url = self._proto_relative_url(self._search_regex(
|
||||
r'<script src="((?:https?)?//stc.iqiyipic.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
|
||||
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
|
||||
webpack_js = self._download_webpage(webpack_js_url, video_id, note='Downloading webpack JS', errnote='Unable to download webpack JS')
|
||||
webpack_map = self._search_json(
|
||||
r'["\']\s*\+\s*', webpack_js, 'JS locations', video_id,
|
||||
|
@ -22,7 +22,7 @@ def _extract_packed(self, webpage):
|
||||
packed = self._search_regex(
|
||||
r'(eval\(function.+)', webpage, 'packed code')
|
||||
unpacked = decode_packed_codes(packed)
|
||||
digits = self._search_regex(r'\[((?:\d+,?)+)\]', unpacked, 'digits')
|
||||
digits = self._search_regex(r'\[([\d,]+)\]', unpacked, 'digits')
|
||||
digits = [int(digit) for digit in digits.split(',')]
|
||||
key_digit = self._search_regex(
|
||||
r'fromCharCode\(.+?(\d+)\)}', unpacked, 'key digit')
|
||||
|
@ -3117,7 +3117,7 @@ def _extract_n_function_name(self, jscode):
|
||||
return funcname
|
||||
|
||||
return json.loads(js_to_json(self._search_regex(
|
||||
rf'var {re.escape(funcname)}\s*=\s*(\[.+?\])[,;]', jscode,
|
||||
rf'var {re.escape(funcname)}\s*=\s*(\[.+?\])\s*[,;]', jscode,
|
||||
f'Initial JS player n function list ({funcname}.{idx})')))[int(idx)]
|
||||
|
||||
def _extract_n_function_code(self, video_id, player_url):
|
||||
|
@ -1,3 +1,4 @@
|
||||
# flake8: noqa: F401, F403
|
||||
import warnings
|
||||
|
||||
from ..compat.compat_utils import passthrough_module
|
||||
|
Loading…
Reference in New Issue
Block a user