Instapy: Failed to get comments' count!

Created on 1 Apr 2019  路  5Comments  路  Source: timgrossmann/InstaPy


Expected Behavior

Perform comments as usual

Current Behavior

None of the posts is commented on and I receive the following error:

Failed to get comments' count!
    b"Message: javascript error: Cannot read property 'count' of undefined\n  (Session info: chrome=72.0.3626.96)\n  (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.18.0-1011-azure x86_64)\n"

Possible Solution (optional)

InstaPy configuration

Working with python 3.6.7 on ubuntu

with smart_run(session):
    """ Activity flow """
    # general settings
    session.set_relationship_bounds(enabled=True,
                                      delimit_by_numbers=True,
                                       max_followers=459000,
                                        min_followers=45,
                                        min_following=77)

    session.set_action_delays(enabled=True,
                           like=3,
                           comment=5,
                           follow=4.17,
                           unfollow=28,
                           randomize=True,
                           random_range=(70, 140))

    session.set_dont_like(
        ['dick', 'squirt', 'gay', 'homo', 
         '[nazi', 'promoter'
                  'jew', 'judaism', '[muslim', '[islam', 'bangladesh',
         '[hijab', '[niqab', '[farright', '[rightwing',
        '#conservative', 'death', 'racist'])

    session.set_do_comment(enabled=True, percentage=80)
    session.set_comments(['Awesome', 'Really Cool', 'Great', 'Nice shot! @{}'], media='Photo')
    session.set_do_like(enabled=True, percentage=50)
    session.interact_by_comments(usernames=users[id], posts_amount=80, comments_per_post=5, reply=True, interact=True, randomize=True, media="Photo")

wontfix

Most helpful comment

I fixed the problem changing line 302 on comment_util.py from:

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_comment.count")

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_parent_comment.count")

All 5 comments

having the same issue

I fixed the problem changing line 302 on comment_util.py from:

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_comment.count")

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_parent_comment.count")

@Nucklear thanks, it worked.

Thanks @Nucklear

I fixed the problem changing line 302 on comment_util.py from:

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_comment.count")

comments_count = browser.execute_script( "return window._sharedData.entry_data." "PostPage[0].graphql.shortcode_media." "edge_media_to_parent_comment.count")

Worked like a charm! @timgrossmann maybe this should be updated in the code?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wyvers picture wyvers  路  3Comments

deronsizemore picture deronsizemore  路  3Comments

Spyd3r0us picture Spyd3r0us  路  3Comments

Naramsim picture Naramsim  路  3Comments

tibor picture tibor  路  3Comments