1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 22:37:56 -04:00

[cleanup] Misc fixes

Closes #3565, https://github.com/yt-dlp/yt-dlp/issues/3514#issuecomment-1105944364
This commit is contained in:
pukkandan
2022-04-29 07:18:36 +05:30
parent 0a41f331cc
commit 1d485a1a79
19 changed files with 75 additions and 42 deletions

View File

@@ -245,6 +245,8 @@ DATE_FORMATS_MONTH_FIRST.extend([
PACKED_CODES_RE = r"}\('(.+)',(\d+),(\d+),'([^']+)'\.split\('\|'\)"
JSON_LD_RE = r'(?is)<script[^>]+type=(["\']?)application/ld\+json\1[^>]*>(?P<json_ld>.+?)</script>'
NUMBER_RE = r'\d+(?:\.\d+)?'
def preferredencoding():
"""Get preferred encoding.
@@ -3427,7 +3429,7 @@ def parse_dfxp_time_expr(time_expr):
if not time_expr:
return
mobj = re.match(r'^(?P<time_offset>\d+(?:\.\d+)?)s?$', time_expr)
mobj = re.match(rf'^(?P<time_offset>{NUMBER_RE})s?$', time_expr)
if mobj:
return float(mobj.group('time_offset'))