Compare commits

..

No commits in common. "66e58dccc29de65cc95ee97915987d785b2b4b31" and "a8d5316aaf3dc740aad486b8c394b2f3e70f5a58" have entirely different histories.

2 changed files with 7 additions and 8 deletions

View File

@ -721,7 +721,7 @@ class YoutubeDL(object):
filename = encodeFilename(filename, True).decode(preferredencoding()) filename = encodeFilename(filename, True).decode(preferredencoding())
return sanitize_path(filename) return sanitize_path(filename)
except ValueError as err: except ValueError as err:
self.report_error('Error in output template: ' + error_to_compat_str(err) + ' (encoding: ' + repr(preferredencoding()) + ')') self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')
return None return None
def _match_entry(self, info_dict, incomplete): def _match_entry(self, info_dict, incomplete):
@ -1570,6 +1570,9 @@ class YoutubeDL(object):
else: else:
formats = info_dict['formats'] formats = info_dict['formats']
if not formats:
raise ExtractorError('No video formats found!')
def is_wellformed(f): def is_wellformed(f):
url = f.get('url') url = f.get('url')
if not url: if not url:
@ -1582,10 +1585,7 @@ class YoutubeDL(object):
return True return True
# Filter out malformed formats for better extraction robustness # Filter out malformed formats for better extraction robustness
formats = list(filter(is_wellformed, formats or [])) formats = list(filter(is_wellformed, formats))
if not formats:
raise ExtractorError('No video formats found!')
formats_dict = {} formats_dict = {}
@ -2058,7 +2058,7 @@ class YoutubeDL(object):
try: try:
self.post_process(filename, info_dict) self.post_process(filename, info_dict)
except (PostProcessingError) as err: except (PostProcessingError) as err:
self.report_error('postprocessing: %s' % error_to_compat_str(err)) self.report_error('postprocessing: %s' % str(err))
return return
self.record_download_archive(info_dict) self.record_download_archive(info_dict)
# avoid possible nugatory search for further items (PR #26638) # avoid possible nugatory search for further items (PR #26638)

View File

@ -3970,8 +3970,7 @@ def escape_rfc3986(s):
"""Escape non-ASCII characters as suggested by RFC 3986""" """Escape non-ASCII characters as suggested by RFC 3986"""
if sys.version_info < (3, 0) and isinstance(s, compat_str): if sys.version_info < (3, 0) and isinstance(s, compat_str):
s = s.encode('utf-8') s = s.encode('utf-8')
# ensure unicode: after quoting, it can always be converted return compat_urllib_parse.quote(s, b"%/;:@&=+$,!~*'()?#[]")
return compat_str(compat_urllib_parse.quote(s, b"%/;:@&=+$,!~*'()?#[]"))
def escape_url(url): def escape_url(url):