]> jfr.im git - yt-dlp.git/commitdiff
Strip out internal fields such as `_filename` from infojson (Closes #42)
authorpukkandan <redacted>
Mon, 1 Feb 2021 15:15:14 +0000 (20:45 +0530)
committerpukkandan <redacted>
Mon, 1 Feb 2021 21:49:21 +0000 (03:19 +0530)
:ci skip dl

youtube_dlc/YoutubeDL.py
youtube_dlc/options.py

index 0c82ff5a9c1e6ec054137c629f018bb6009ab678..0b198f50dbc193270bf6385e1b3cf189e0e430ca 100644 (file)
@@ -1136,9 +1136,10 @@ def ensure_dir_exists(path):
                 if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)):
                     self.to_screen('[info] Playlist metadata is already present')
                 else:
-                    self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
                     playlist_info = dict(ie_result)
-                    playlist_info.pop('entries')
+                    # playlist_info['entries'] = list(playlist_info['entries'])  # Entries is a generator which shouldnot be resolved here
+                    del playlist_info['entries']
+                    self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
                     try:
                         write_json_file(self.filter_requested_info(playlist_info), infofn)
                     except (OSError, IOError):
@@ -2464,9 +2465,10 @@ def download_with_info_file(self, info_filename):
 
     @staticmethod
     def filter_requested_info(info_dict):
+        fields_to_remove = ('requested_formats', 'requested_subtitles')
         return dict(
             (k, v) for k, v in info_dict.items()
-            if k not in ['requested_formats', 'requested_subtitles'])
+            if (k[0] != '_' or k == '_type') and k not in fields_to_remove)
 
     def run_pp(self, pp, infodict, files_to_move={}):
         files_to_delete = []
index 2cef01a5ac1efbaf1b42ea97495744d60ad7e4b7..98946666d5ed44202f546b606de4e50548fac35c 100644 (file)
@@ -924,7 +924,7 @@ def _dict_from_multiple_values_options_callback(
     filesystem.add_option(
         '--write-info-json',
         action='store_true', dest='writeinfojson', default=False,
-        help='Write video metadata to a .info.json file')
+        help='Write video metadata to a .info.json file. Note that this may contain personal information')
     filesystem.add_option(
         '--no-write-info-json',
         action='store_false', dest='writeinfojson',