InstaPy / InstaPy/instapy-quickstart

KeyError: "graphq1"

Open
#257 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
777
Forks
763
PR merge metrics
No merged PRs in 30d

Description

Hello everyone,

I am a beginner in Instapy.

Foremost, I have change in file : like_until.py line 619 cause of a ["inappropriate, user_name, is_video, reason, scope = check_link()..."](https://stackoverflow.com/questions/71166123/instapy-issue-inappropriate-user-name-is-video-reason-scope-check-link) because my bot cannot like picture:
media = post_page['items'][0]
is_video = media["is_unified_video"]
user_name = media["user"]["username"]
image_text = media["caption"]["text"]
owner_comments = ""

Instead of :

media = post_page[0]["shortcode_media"]
is_video = media["is_video"]
user_name = media["owner"]["username"]
image_text = media["caption"]
owner_comments = browser.execute_script(
"""
latest_comments = window._sharedData.entry_data.PostPage[
0].media.comments.nodes;
if (latest_comments === undefined) {
latest_comments = Array();
owner_comments = latest_comments
.filter(item => item.user.username == arguments[0])
.map(item => item.text)
.reduce((item, total) => item + '\\n' + total, '');
return owner_comments;}
else {
return null;}
""",
user_name,
)

Now the bot can like one picture and then appear in line 523 :

Traceback (most recent call last):
File "/Users/Desktop/instapy-quickstart-master/run/../quickstart.py", line 39, in
session.like_by_tags(TAGS_A_SUIVRE, amount=10)
File "/Users/miniforge3/lib/python3.9/site-packages/instapy/instapy.py", line 2059, in like_by_tags
success = process_comments(
File "/Users/miniforge3/lib/python3.9/site-packages/instapy/comment_util.py", line 445, in process_comments
commented_image, message = verify_commented_image(browser, link, owner, logger)
File "/Users/miniforge3/lib/python3.9/site-packages/instapy/comment_util.py", line 366, in verify_commented_image
data = getMediaData("edge_media_to_parent_comment", browser)
File "/Users/miniforge3/lib/python3.9/site-packages/instapy/util.py", line 523, in getMediaData
data = additional_data["graphql"]["shortcode_media"]
KeyError: 'graphql'

What should I do ?

The script is attached.
Capture d’écran 2022-03-22 à 16 50 51

Thanks for your response

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.