From 969d4e3aa4de8a97613d287fdf681b08acb4be19 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Fri, 15 Jun 2018 17:07:28 +0200 Subject: [PATCH] Post: Write all ever-obtained metadata into JSON The Post._asdict() code assumed that Post._node always is a subset of Post._full_metadata_dict. However, it turned out, that `edge_liked_by`, `thumbnail_src` and `thumbnail_resources` may be contained in Post._node, but not in Post._full_metadata_dict. Now the keys of both dictionaries are saved in the JSON file. Fixes #137. --- instaloader/structures.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index e05da77..7e19c9d 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -93,10 +93,9 @@ class Post: return b64encode(mediaid.to_bytes(9, 'big'), b'-_').decode().replace('A', ' ').lstrip().replace(' ', 'A') def _asdict(self): + node = self._node if self._full_metadata_dict: - node = self._full_metadata_dict - else: - node = self._node + node.update(self._full_metadata_dict) if self._owner_profile: node['owner'] = self.owner_profile._asdict() if self._location: