diff --git a/instagram/models.py b/instagram/models.py index d2517ca2..7adcffbd 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -84,6 +84,7 @@ def object_from_dictionary(cls, entry): if new_media.type == 'video': new_media.videos = {} for version, version_info in six.iteritems(entry['videos']): + version_info.pop('id', None) new_media.videos[version] = Video.object_from_dictionary(version_info) if 'user_has_liked' in entry: @@ -96,8 +97,9 @@ def object_from_dictionary(cls, entry): new_media.comment_count = entry['comments']['count'] new_media.comments = [] - for comment in entry['comments']['data']: - new_media.comments.append(Comment.object_from_dictionary(comment)) + if "data" in entry["comments"]: + for comment in entry['comments']['data']: + new_media.comments.append(Comment.object_from_dictionary(comment)) new_media.users_in_photo = [] if entry.get('users_in_photo'):