Instaloader: Can't Get All Comments from Post

Created on 9 Jun 2020  路  3Comments  路  Source: instaloader/instaloader

Hi, I've got a little problem here, when I try to get all comments, it seems I just got a half of total comments on the post when I loop data from .get_comments(). Is it my code problem? or have you any idea why this can be happen?(Image below)
Annotation 2020-06-09 185251

duplicate

Most helpful comment

There is a hypothesis why .get_comments() method does not load all comments. I made it by looking at such cases manually.

It returns only the basic _(directly below the publication)_ comments. Comments written in response to basic ones are not included. Check it out

Duplicate of https://github.com/instaloader/instaloader/issues/460#, https://github.com/instaloader/instaloader/issues/590#

All 3 comments

There is a hypothesis why .get_comments() method does not load all comments. I made it by looking at such cases manually.

It returns only the basic _(directly below the publication)_ comments. Comments written in response to basic ones are not included. Check it out

Duplicate of https://github.com/instaloader/instaloader/issues/460#, https://github.com/instaloader/instaloader/issues/590#

There is a hypothesis why .get_comments() method does not load all comments. I made it by looking at such cases manually.

It returns only the basic _(directly below the publication)_ comments. Comments written in response to basic ones are not included. Check it out

Duplicate of #460, #590

Hi @shepurev Thanks for your answer

In your given example get_comments() does in fact load all comments. Comments written in response to basic ones are included and can be accessed through the answers field which is nested inside each comment.

import instaloader
L = instaloader.Instaloader()

post = instaloader.Post.from_shortcode(L.context, 'CBAQLopB6d3')

comments_from_loop_including_answers = []

for comment in post.get_comments():
    comments_from_loop_including_answers.append(comment)
    for answer in comment.answers:
        comments_from_loop_including_answers.append(answer)

print(len(comments_from_loop_including_answers))    # output: 8
print(post.comments)                                # output: 8
Was this page helpful?
0 / 5 - 0 ratings

Related issues

milankhatir picture milankhatir  路  3Comments

Fickbert picture Fickbert  路  4Comments

aaasddd picture aaasddd  路  4Comments

imshub picture imshub  路  4Comments

WaseemRakab picture WaseemRakab  路  3Comments