mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-01-06 06:51:30 +00:00
Merge remote-tracking branch 'upstream/master' into wait-retries
This commit is contained in:
@@ -54,7 +54,7 @@ from ..compat import (
|
||||
from ..dependencies import xattr
|
||||
from ..globals import IN_CLI
|
||||
|
||||
__name__ = __name__.rsplit('.', 1)[0] # noqa: A001: Pretend to be the parent module
|
||||
__name__ = __name__.rsplit('.', 1)[0] # noqa: A001 # Pretend to be the parent module
|
||||
|
||||
|
||||
class NO_DEFAULT:
|
||||
@@ -2053,7 +2053,7 @@ def url_or_none(url):
|
||||
if not url or not isinstance(url, str):
|
||||
return None
|
||||
url = url.strip()
|
||||
return url if re.match(r'(?:(?:https?|rt(?:m(?:pt?[es]?|fp)|sp[su]?)|mms|ftps?):)?//', url) else None
|
||||
return url if re.match(r'(?:(?:https?|rt(?:m(?:pt?[es]?|fp)|sp[su]?)|mms|ftps?|wss?):)?//', url) else None
|
||||
|
||||
|
||||
def strftime_or_none(timestamp, date_format='%Y%m%d', default=None):
|
||||
@@ -2776,7 +2776,8 @@ def js_to_json(code, vars={}, *, strict=False):
|
||||
def template_substitute(match):
|
||||
evaluated = js_to_json(match.group(1), vars, strict=strict)
|
||||
if evaluated[0] == '"':
|
||||
return json.loads(evaluated)
|
||||
with contextlib.suppress(json.JSONDecodeError):
|
||||
return json.loads(evaluated)
|
||||
return evaluated
|
||||
|
||||
def fix_kv(m):
|
||||
@@ -3256,7 +3257,7 @@ def _match_one(filter_part, dct, incomplete):
|
||||
op = lambda attr, value: not unnegated_op(attr, value)
|
||||
else:
|
||||
op = unnegated_op
|
||||
comparison_value = m['quotedstrval'] or m['strval'] or m['intval']
|
||||
comparison_value = m['quotedstrval'] or m['strval']
|
||||
if m['quote']:
|
||||
comparison_value = comparison_value.replace(r'\{}'.format(m['quote']), m['quote'])
|
||||
actual_value = dct.get(m['key'])
|
||||
|
||||
Reference in New Issue
Block a user