diff options
author | Sergey M․ <dstftw@gmail.com> | 2017-08-17 23:59:12 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2017-08-17 23:59:12 +0700 |
commit | a5ac0c475589fd1dcd3ba04802f28828c24be6c9 (patch) | |
tree | fce91db1061d7f694f308db2d24919f47fa71593 /youtube_dl/YoutubeDL.py | |
parent | 5551d7714d53caaaae32cdedad11a0bdc95efcf1 (diff) |
[YoutubeDL] Sanitize byte string format URLs (#13951)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index df7378f83..5f4c93ea3 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1483,12 +1483,14 @@ class YoutubeDL(object): def is_wellformed(f): url = f.get('url') - valid_url = url and isinstance(url, compat_str) - if not valid_url: + if not url: self.report_warning( '"url" field is missing or empty - skipping format, ' '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 formats = list(filter(is_wellformed, formats)) |