Fix --flat-playlist when entry has no ie_key

This commit is contained in:
pukkandan 2021-06-24 20:08:43 +05:30
parent bd4d1ea398
commit 6033d9808d
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -104,6 +104,7 @@ from .utils import (
ThrottledDownload, ThrottledDownload,
to_high_limit_path, to_high_limit_path,
traverse_obj, traverse_obj,
try_get,
UnavailableVideoError, UnavailableVideoError,
url_basename, url_basename,
version_tuple, version_tuple,
@ -1176,13 +1177,17 @@ class YoutubeDL(object):
return ie_result return ie_result
def add_default_extra_info(self, ie_result, ie, url): def add_default_extra_info(self, ie_result, ie, url):
self.add_extra_info(ie_result, { if url is not None:
'extractor': ie.IE_NAME, self.add_extra_info(ie_result, {
'webpage_url': url, 'webpage_url': url,
'original_url': url, 'original_url': url,
'webpage_url_basename': url_basename(url), 'webpage_url_basename': url_basename(url),
'extractor_key': ie.ie_key(), })
}) if ie is not None:
self.add_extra_info(ie_result, {
'extractor': ie.IE_NAME,
'extractor_key': ie.ie_key(),
})
def process_ie_result(self, ie_result, download=True, extra_info={}): def process_ie_result(self, ie_result, download=True, extra_info={}):
""" """
@ -1201,8 +1206,8 @@ class YoutubeDL(object):
or extract_flat is True): or extract_flat is True):
info_copy = ie_result.copy() info_copy = ie_result.copy()
self.add_extra_info(info_copy, extra_info) self.add_extra_info(info_copy, extra_info)
self.add_default_extra_info( ie = try_get(ie_result.get('ie_key'), self.get_info_extractor)
info_copy, self.get_info_extractor(ie_result.get('ie_key')), ie_result['url']) self.add_default_extra_info(info_copy, ie, ie_result['url'])
self.__forced_printings(info_copy, self.prepare_filename(info_copy), incomplete=True) self.__forced_printings(info_copy, self.prepare_filename(info_copy), incomplete=True)
return ie_result return ie_result