diff options
| author | Gabriel Nagy <gabrielnagy@me.com> | 2023-04-13 01:40:38 +0300 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-12 23:40:38 +0100 | 
| commit | 735e87adfc44b284dcdb4d9a0155ce0616e3af97 (patch) | |
| tree | 04afbcbf3c9e82a3ca8c65bc9f9daeb0940a2700 | |
| parent | fe7e13066c20b10fe48bc154431440da36baec53 (diff) | |
[core] Sanitize info dict before dumping JSON (fixes fe7e130)  (#32032)
* follow up to fe7e130 which didn't fix everything.
Co-authored-by: dirkf <fieldhouse@gmx.net>
| -rwxr-xr-x | youtube_dl/YoutubeDL.py | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 2719d546f..117f1c513 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1777,7 +1777,7 @@ class YoutubeDL(object):              self.to_stdout(formatSeconds(info_dict['duration']))          print_mandatory('format')          if self.params.get('forcejson', False): -            self.to_stdout(json.dumps(info_dict)) +            self.to_stdout(json.dumps(self.sanitize_info(info_dict)))      def process_info(self, info_dict):          """Process a single resolved IE result.""" @@ -2091,7 +2091,7 @@ class YoutubeDL(object):                  raise              else:                  if self.params.get('dump_single_json', False): -                    self.to_stdout(json.dumps(res)) +                    self.to_stdout(json.dumps(self.sanitize_info(res)))          return self._download_retcode @@ -2100,6 +2100,7 @@ class YoutubeDL(object):                  [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 +            # TODO: let's use io.open(), then              info = self.filter_requested_info(json.loads('\n'.join(f)))          try:              self.process_ie_result(info, download=True) | 
