[cleanup] Misc

This commit is contained in:
pukkandan 2022-09-10 03:46:54 +05:30
parent 941e881e1f
commit deae7c1711
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
5 changed files with 15 additions and 11 deletions

View file

@ -1247,9 +1247,11 @@ class YoutubeDL:
delim = '\n' if '#' in flags else ', '
value, fmt = delim.join(map(str, variadic(value, allowed_types=(str, bytes)))), str_fmt
elif fmt[-1] == 'j': # json
value, fmt = json.dumps(value, default=_dumpjson_default, indent=4 if '#' in flags else None), str_fmt
value, fmt = json.dumps(
value, default=_dumpjson_default,
indent=4 if '#' in flags else None, ensure_ascii=False), str_fmt
elif fmt[-1] == 'h': # html
value, fmt = escapeHTML(value), str_fmt
value, fmt = escapeHTML(str(value)), str_fmt
elif fmt[-1] == 'q': # quoted
value = map(str, variadic(value) if '#' in flags else [value])
value, fmt = ' '.join(map(compat_shlex_quote, value)), str_fmt

View file

@ -121,7 +121,7 @@ class FileDownloader:
if time.hours > 99:
return '--:--:--'
if not time.hours:
return '%02d:%02d' % time[1:-1]
return ' %02d:%02d' % time[1:-1]
return '%02d:%02d:%02d' % time[:-1]
format_eta = format_seconds

View file

@ -2765,7 +2765,7 @@ class GenericIE(InfoExtractor):
'age_limit': self._rta_search(webpage),
})
domain_name = self._search_regex(r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
domain_name = self._search_regex(r'^(?:https?://)?([^/]*)/.*', url, 'video uploader', default=None)
# Sometimes embedded video player is hidden behind percent encoding
# (e.g. https://github.com/ytdl-org/youtube-dl/issues/2448)

View file

@ -3625,7 +3625,7 @@ def determine_protocol(info_dict):
ext = determine_ext(url)
if ext == 'm3u8':
return 'm3u8'
return 'm3u8' if info_dict.get('is_live') else 'm3u8_native'
elif ext == 'f4m':
return 'f4m'