aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-02-01 20:45:14 +0530
committerpukkandan <pukkandan@gmail.com>2021-02-02 03:19:21 +0530
commit18590cecdbeb8e9c525ecedbb973586e9c59574f (patch)
tree8f3471dee41ad2781ab6f8453161d201700b1c68
parent9f888147de8f99abbbc29d0409a26ae7a55443b8 (diff)
downloadhypervideo-pre-18590cecdbeb8e9c525ecedbb973586e9c59574f.tar.lz
hypervideo-pre-18590cecdbeb8e9c525ecedbb973586e9c59574f.tar.xz
hypervideo-pre-18590cecdbeb8e9c525ecedbb973586e9c59574f.zip
Strip out internal fields such as `_filename` from infojson (Closes #42)
:ci skip dl
-rw-r--r--youtube_dlc/YoutubeDL.py8
-rw-r--r--youtube_dlc/options.py2
2 files changed, 6 insertions, 4 deletions
diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py
index 0c82ff5a9..0b198f50d 100644
--- a/youtube_dlc/YoutubeDL.py
+++ b/youtube_dlc/YoutubeDL.py
@@ -1136,9 +1136,10 @@ class YoutubeDL(object):
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 @@ class YoutubeDL(object):
@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 = []
diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py
index 2cef01a5a..98946666d 100644
--- a/youtube_dlc/options.py
+++ b/youtube_dlc/options.py
@@ -924,7 +924,7 @@ def parseOpts(overrideArguments=None):
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',