1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-08-18 12:49:38 +02:00

Fix KeyError on Posts with very few comments

This commit is contained in:
Alexander Graf 2020-07-15 10:17:20 +02:00
parent db63e5c7e5
commit 4c20b573e2

View File

@ -416,7 +416,7 @@ class Post:
return
comment_edges = self._field('edge_media_to_comment', 'edges')
answers_count = sum([edge['node']['edge_threaded_comments']['count'] for edge in comment_edges])
answers_count = sum([edge['node'].get('edge_threaded_comments', {}).get('count', 0) for edge in comment_edges])
if self.comments == len(comment_edges) + answers_count:
# If the Post's metadata already contains all parent comments, don't do GraphQL requests to obtain them