Instapy: key error media

Created on 26 Oct 2019  路  26Comments  路  Source: timgrossmann/InstaPy

Hello,
my bot do not want to start anymore,
he tells me:

Traceback (most recent call last):
File "C:\Users\surfacepro4\Documents\instapy\instapy-commentaires\quickstart.py", line 50, in
amount=60, skip_top_posts=True)
File "C:\Users\surfacepro4\AppData\Local\Programs\Python\Python36\lib\site-packages\instapy\instapy.py", line 1785, in like_by_tags
self.logger)
File "C:\Users\surfacepro4\AppData\Local\Programs\Python\Python36\lib\site-packages\instapy\like_util.py", line 560, in check_link
media = post_page[0]['media']
KeyError: 'media'

I can not find a solution.
Everything worked the days before

wontfix

All 26 comments

Having the same issue, running on Ubuntu 18.04 and Python 3.6.7

Seems like the issue is at
venv/lib/python3.6/site-packages/instapy/like_util.py:554

where the following script returns an empty result:
post_page = browser.execute_script( "return window._sharedData.entry_data.PostPage" )

Same issue here.

Traceback (most recent call last):
File "likes.py", line 36, in
session.like_by_feed(amount=30, randomize=False, unfollow=False, interact=False)
File "/home/agustin/.local/lib/python3.5/site-packages/instapy/instapy.py", line 3474, in like_by_feed
for i in self.like_by_feed_generator(**kwargs):
File "/home/agustin/.local/lib/python3.5/site-packages/instapy/instapy.py", line 3574, in like_by_feed_generator
self.logger)
File "/home/agustin/.local/lib/python3.5/site-packages/instapy/like_util.py", line 553, in check_link
media = post_page[0]['media']
KeyError: 'media'

Does this happen when they change the API? I'm also having problems accessing my profile on Chrome - would Chromium driver carry the same issue?

FWIW, I'm getting the same issue all of a sudden, too.

got this issue out of the blue as well. tried to fix the like_util file with a commit I found from September but running into the same issue

Same issue on macOS 10.15
Error output :
File "/Library/Python/2.7/site-packages/instapy/like_util.py", line 589, in check_link
media = post_page[0]['media']
KeyError: 'media'

any news ?

i thought i was in the clear from having issues with instapy until this KeyError showed up lol

I am also having this issue...

For me, upgrading to the newest version solved the issue.

@jazzisnice damn i've been avoiding the newest versions. guess i'll have to bite the bullet

For me, upgrading to the newest version solved the issue.

you mean you just run update.command from installation dir and then the issue was disappeared?

For me, upgrading to the newest version solved the issue.

you mean you just run update.command from installation dir and then the issue was disappeared?

I used pip, as far as I remember upgraded from 0.6.2 to 0.6.5

It doesn't help me
Can the problem root cause be that I updated the chrome driver for supporting google chrome v.78?

I have this issue also.

Latest Python and Instapy.

Drive is 2.46

Same. 0.5.8
Using the new version just kicks Action Block right away.
The old use to work great.

Same issue on Mac

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

We are still stuck in this, I was trying this days to see why it crashes.
The function check_link raises a KeyError: media, but the post_page is not empty.
I'll keep you update as i try to fix.

Im getting the same error. Any updates by now?

Instagram changed its js. The data path is back to __additionalData and is now behind post path root node:
post_page = browser.execute_script( "return window.__additionalData['{}']".format(post_link[25:]))

The graphql can be recover with:
post_page['data']['graphql']

However, post_link is not available everywhere, so this might imply a refactoring of comment_util.py and like_util.py to pass it as argument

How do we continue to bump this bug? Longest unsolvable bug i've seen!

For me, upgrading to the newest version solved the issue.

Can you tell us your dependencies? Python version and instapy version?

I have the same issue but anyone seem to know fix the bug :(

I have the same issue :-( Does someone know how to solve it, please?

Guys, now it worked for me running with "python3", instead of "python" or "python2"!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

hi, after a long stop using InstaPy, I starded again. I updated InstaPy with pip, but error #5359 occurred. Now I solved it, but run across this "key error media". I am unable to solve it. Help apreciated! Before the stop many months ago all was working well.

Was this page helpful?
0 / 5 - 0 ratings