mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 14:24:03 -07:00
Sanitize info dict before dumping JSON
This is a follow up to fe7e130
I think which didn't fix everything.
Sample failing command:
> youtube-dl --print-json "https://www.youtube.com/watch?v=SrK1yv3g8dI"
Traceback (most recent call last):
File "/home/gabi/.local/bin/youtube-dl", line 8, in <module>
sys.exit(main())
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/__init__.py", line 475, in main
_real_main(argv)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/__init__.py", line 465, in _real_main
retcode = ydl.download(all_urls)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 2085, in download
res = self.extract_info(
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 815, in extract_info
return self.__extract_info(url, ie, download, extra_info, process)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 822, in wrapper
return func(self, *args, **kwargs)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 854, in __extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 888, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 1698, in process_video_result
self.process_info(new_info)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 1807, in process_info
self.__forced_printings(info_dict, filename, incomplete=False)
File "/home/gabi/.local/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 1780, in __forced_printings
self.to_stdout(json.dumps(info_dict))
File "/usr/lib/python3.10/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type LazyList is not JSON serializable
This commit is contained in:
parent
fe7e13066c
commit
206738dc5c
1 changed files with 1 additions and 1 deletions
|
@ -1804,7 +1804,7 @@ class YoutubeDL(object):
|
|||
info_dict['_filename'] = filename = self.prepare_filename(info_dict)
|
||||
|
||||
# Forced printings
|
||||
self.__forced_printings(info_dict, filename, incomplete=False)
|
||||
self.__forced_printings(self.filter_requested_info(info_dict), filename, incomplete=False)
|
||||
|
||||
# Do nothing else if in simulate mode
|
||||
if self.params.get('simulate', False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue