mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 00:44:03 -05:00
Fix --list-formats (Closes #799)
This commit is contained in:
parent
74e3452b9e
commit
c681a03918
2 changed files with 5 additions and 6 deletions
|
@ -458,6 +458,8 @@ def extract_info(self, url, download = True, ie_name = None):
|
||||||
# Extract information from URL and process it
|
# Extract information from URL and process it
|
||||||
try:
|
try:
|
||||||
ie_results = ie.extract(url)
|
ie_results = ie.extract(url)
|
||||||
|
if ie_results is None: # Finished already (backwards compatibility; listformats and friends should be moved here)
|
||||||
|
break
|
||||||
results = []
|
results = []
|
||||||
for ie_result in ie_results:
|
for ie_result in ie_results:
|
||||||
if not 'extractor' in ie_result:
|
if not 'extractor' in ie_result:
|
||||||
|
|
|
@ -622,8 +622,7 @@ def _real_extract(self, url):
|
||||||
format_list = available_formats
|
format_list = available_formats
|
||||||
existing_formats = [x for x in format_list if x in url_map]
|
existing_formats = [x for x in format_list if x in url_map]
|
||||||
if len(existing_formats) == 0:
|
if len(existing_formats) == 0:
|
||||||
self._downloader.report_error(u'no known formats available for video')
|
raise ExtractorError(u'no known formats available for video')
|
||||||
return
|
|
||||||
if self._downloader.params.get('listformats', None):
|
if self._downloader.params.get('listformats', None):
|
||||||
self._print_formats(existing_formats)
|
self._print_formats(existing_formats)
|
||||||
return
|
return
|
||||||
|
@ -643,11 +642,9 @@ def _real_extract(self, url):
|
||||||
video_url_list = [(rf, url_map[rf])]
|
video_url_list = [(rf, url_map[rf])]
|
||||||
break
|
break
|
||||||
if video_url_list is None:
|
if video_url_list is None:
|
||||||
self._downloader.report_error(u'requested format not available')
|
raise ExtractorError(u'requested format not available')
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
self._downloader.report_error(u'no conn or url_encoded_fmt_stream_map information found in video info')
|
raise ExtractorError(u'no conn or url_encoded_fmt_stream_map information found in video info')
|
||||||
return
|
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for format_param, video_real_url in video_url_list:
|
for format_param, video_real_url in video_url_list:
|
||||||
|
|
Loading…
Reference in a new issue