1

我正在使用 instapy-0.6.14

代码:

from instapy import InstaPy

import random
from instapy import InstaPy
from instapy import smart_run

#login credentials
insta_username = '****'
insta_password = '****'

#login session
session = InstaPy(username=insta_username, password=insta_password)
session.login()

session.like_by_tags(["#carz"], amount=5)

低于错误

回溯(最后一次调用):文件“E:\Study\Python_Automation\Insta_Commentor\quickstart.py”,第 56 行,在 session.like_by_tags(my_hashtags, amount=90, media=None) 文件“C:\Users\sonu3 \AppData\Local\Programs\Python\Python310\lib\site-packages\instapy\instapy.py",第 1977 行,在 like_by_tags 中不恰当,user_name,is_video,原因,范围 = check_link( 文件 "C:\Users\sonu3\ AppData\Local\Programs\Python\Python310\lib\site-packages\instapy\like_util.py",第 618 行,在 check_link media = post_page[0]["shortcode_media"] KeyError: 0

4

1 回答 1

0

这为我解决了这个问题: https ://github.com/InstaPy/InstaPy/issues/6472


Line 619 etc. replaced with:
logger.info("post_page: {}".format(post_page))
media = post_page ['items'] [0]
is_video = media ["is_unified_video"]
user_name = media ["user"] ["username"]
image_text = media ["caption"] ["text"]
owner_comments = ""
于 2022-02-19T15:59:05.827 回答