1

I am using instapy-0.6.14

code:

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)

getting below error

Traceback (most recent call last): File "E:\Study\Python_Automation\Insta_Commentor\quickstart.py", line 56, in session.like_by_tags(my_hashtags, amount=90, media=None) File "C:\Users\sonu3\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy\instapy.py", line 1977, in like_by_tags inappropriate, user_name, is_video, reason, scope = check_link( File "C:\Users\sonu3\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy\like_util.py", line 618, in check_link media = post_page[0]["shortcode_media"] KeyError: 0

Sonu Tyagi
  • 11
  • 2

1 Answers1

0

This solved it for me: 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 = ""
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 19 '22 at 18:46