Abdulmohsen 2024-04-20 19:28:52 +02:00 zatwierdzone przez GitHub
commit 8c5192030f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 13 dodań i 7 usunięć

Wyświetl plik

@ -3574,13 +3574,10 @@ class YoutubeDL:
return self._download_retcode
def download_with_info_file(self, info_filename):
with contextlib.closing(fileinput.FileInput(
[info_filename], mode='r',
openhook=fileinput.hook_encoded('utf-8'))) as f:
# FileInput doesn't have a read method, we can't call json.load
infos = [self.sanitize_info(info, self.params.get('clean_infojson', True))
for info in variadic(json.loads('\n'.join(f)))]
def download_with_info(self, *info_list):
"""Download using already extracted info_dicts."""
infos = [self.sanitize_info(info, self.params.get('clean_infojson', True))
for info in info_list]
for info in infos:
try:
self.__download_wrapper(self.process_ie_result)(info, download=True)
@ -3596,6 +3593,15 @@ class YoutubeDL:
self.report_error(e)
return self._download_retcode
def download_with_info_file(self, info_filename):
"""Download using an info file."""
with contextlib.closing(fileinput.FileInput(
[info_filename], mode='r',
openhook=fileinput.hook_encoded('utf-8'))) as f:
# FileInput doesn't have a read method, we can't call json.load
infos = [info for info in variadic(json.loads('\n'.join(f)))]
return self.download_with_info(infos)
@staticmethod
def sanitize_info(info_dict, remove_private_keys=False):
''' Sanitize the infodict for converting to json '''