InstaPy / InstaPy/instapy-quickstart

KeyError: "graphq1"

オープン
#257 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
777
フォーク
763
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

quickstart.py の 39 行目から始め、comment_util.py の 366 行目と util.py の 523 行目にある like_by_tags の経路を追ってください。like_until.py の 619 行目で使用されているレスポンスの形状と、getMediaData で想定されているデータを比較してください。コメントの処理中に、添付された quickstart フローが KeyError: 'graphql' で失敗しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。