InstaPy / InstaPy/instapy-quickstart

KeyError: "graphq1"

Offen
#257 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
777
Forks
763
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with quickstart.py line 39 and follow the like_by_tags path into comment_util.py line 366 and util.py line 523. Compare the response shape used by like_until.py line 619 with the data expected at getMediaData. Done means the attached quickstart flow no longer fails with KeyError: 'graphql' while processing comments.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.