1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-26 22:22:30 +02:00

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.
This commit is contained in:
Alexander Graf 2018-06-15 17:07:28 +02:00
parent 4cf1ae847d
commit 969d4e3aa4

View File

@ -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: