diff --git a/instaloader/structures.py b/instaloader/structures.py index 3b5ecd1..29a5b2e 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -134,6 +134,12 @@ class Post: pic_json = self._context.get_json("p/{0}/".format(self.shortcode), params={}) self._full_metadata_dict = pic_json['entry_data']['PostPage'][0]['graphql']['shortcode_media'] self._rhx_gis_str = pic_json.get('rhx_gis') + if self._full_metadata_dict is None: + # issue #449 + self._context.error("Fetching Post metadata failed (issue #449). " + "The following data has been returned:\n" + + json.dumps(pic_json['entry_data'], indent=2)) + raise BadResponseException("Fetching Post metadata failed.") if self.shortcode != self._full_metadata_dict['shortcode']: self._node.update(self._full_metadata_dict) raise PostChangedException