mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-22 02:15:12 +00:00
[YoutubeDL] Sanitize byte string format URLs (#13951)
This commit is contained in:
parent
5551d7714d
commit
a5ac0c4755
1 changed files with 5 additions and 3 deletions
|
@ -1483,12 +1483,14 @@ def sanitize_numeric_fields(info):
|
||||||
|
|
||||||
def is_wellformed(f):
|
def is_wellformed(f):
|
||||||
url = f.get('url')
|
url = f.get('url')
|
||||||
valid_url = url and isinstance(url, compat_str)
|
if not url:
|
||||||
if not valid_url:
|
|
||||||
self.report_warning(
|
self.report_warning(
|
||||||
'"url" field is missing or empty - skipping format, '
|
'"url" field is missing or empty - skipping format, '
|
||||||
'there is an error in extractor')
|
'there is an error in extractor')
|
||||||
return valid_url
|
return False
|
||||||
|
if isinstance(url, bytes):
|
||||||
|
sanitize_string_field(f, 'url')
|
||||||
|
return True
|
||||||
|
|
||||||
# Filter out malformed formats for better extraction robustness
|
# Filter out malformed formats for better extraction robustness
|
||||||
formats = list(filter(is_wellformed, formats))
|
formats = list(filter(is_wellformed, formats))
|
||||||
|
|
Loading…
Reference in a new issue