Instapy: Error: Cannot read property 'entry_data' of undefined

Created on 6 Nov 2017  路  30Comments  路  Source: timgrossmann/InstaPy

image

bug help wanted

Most helpful comment

It seems to work now. Thanks @dreamyUB

All 30 comments

if anyone have time to take a look on it or try to fix it, it's something related to the javascript. @dreamyUB that would help too.

@converge Well I see he is using 2.30 and latest is 2.33, we dont have respone from @datteba maybe updating driver worked for him

It seems to work now. Thanks @dreamyUB

Still the same problem :(

@dreamyUB @timgrossmann

image

Which version of python you got? @datteba

@dreamyUB 2.7

image

@datteba What methods are you using?
Please paste your quickstart file

I'm getting the exact same issue. Running Python 3.6.3 as well as chromedriver 2.33

It's stopping anywhere between 20 and 90 likes for me. Have only just started using it so am using basic commands

My quickstart.py

from instapy import InstaPy

insta_username = ''
insta_password = ''

# if you want to run this script on a server, 
# simply add nogui=True to the InstaPy() constructor
session = InstaPy(username=insta_username, password=insta_password)
session.login()

# set up all the settings
session.set_upper_follower_count(limit=2500)
session.set_do_comment(True, percentage=50)
session.set_comments(['Awesome!', 'Great shot!!', 'Nice!', 'Love this!'])
session.set_dont_include(['friend1', 'friend2', 'friend3'])
session.set_dont_like(['pizza', 'girl', 'sad'])

# do the actual liking
session.like_by_tags(['explore', 'travel'], amount=100)

# end the bot session
session.end()

Now I also get this error running Python 2.7.10 and chromedriver 2.33 on OS X Sierra.

Edit: this exception now occurs every time I run the script.

@converge I did some more testing and found out that the exception didn't occur when I left the screen of my macbook on all night. Normally the display automatically turns off after 10 minutes but this time I changed the settings using the Energy Saver app and the script is still running flawlessly after 20+ hours.

Sounds a bit weird so I will look into this more thoroughly but for once my script didn't crash so that's already a big relief.

@rvoets You could try to use the relatively new headless feature which does not rely on the screen web browser open all the time #1020

@timgrossmann Thanks, I will give that a try.

@timgrossmann Unfortunately the new headless feature doesn't work for me. After about 10 likes the script crashes with the "Element not visible" exception.

File "/Users/roland/workspace/test/InstaPy/instapy/instapy.py", line 717, in like_by_tags self.logger) File "/Users/roland/workspace/test/InstaPy/instapy/unfollow_util.py", line 349, in follow_user follow_button.click() File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webelement.py", line 72, in click self._execute(Command.CLICK_ELEMENT) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webelement.py", line 461, in _execute return self._parent.execute(command, params) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 236, in execute self.error_handler.check_response(response) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotVisibleException: Message: element not visible (Session info: headless chrome=62.0.3202.94) (Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64)

hey @rvoets, can you add the following line to the unfollow_util.py file, in line 344:

browser.get_screenshot_as_file('screen-at-error.png')

This will take a screenshot at the point of error when executing the script and save as file screen-at-error.png in the instapy folder. If you could post the screenshot here it may help us debug the Headless feature! Thanks :)

@chrismaltais Sure, will do!

I'm still getting the entry data error. Anyone else managed to fix it without using the new headless feature?

Same here, every day this error pops up.

This issue still persists.

I just had this error as well after modifying my script.

The script worked well until I added

like_count_feed = (randint(50, 55))
session.like_by_feed(amount=like_count_feed, randomize=True, interact=True)

Now, that I added the like_by_feed functionality I get this error:

File "seppl_insta.py", line 84, in
schedule.run_pending()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 493, in run_pending
default_scheduler.run_pending()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 78, in run_pending
self._run_job(job)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 131, in _run_job
ret = job.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 411, in run
ret = self.job_func()
File "seppl_insta.py", line 48, in job
session.like_by_feed(amount=like_count_feed, randomize=True, interact=True)
File "/Users/sepp/InstaPy-seppl_insta/instapy/instapy.py", line 1391, in like_by_feed
self.logger)
File "/Users/sepp/InstaPy-seppl_insta/instapy/like_util.py", line 482, in check_link
"return window._sharedData.entry_data."
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 543, in execute_script
'args': converted_args})['value']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'entry_data' of undefined
(Session info: headless chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.1 x86_64)

And the log before:

2018-01-30 09:52:55 - INFO - Commented: 0
2018-01-30 09:52:55 - INFO - --> Not commented
2018-01-30 09:53:21 - INFO - --> Already following
2018-01-30 09:53:21 - WARNING - Post Randomly Skipped...

2018-01-30 09:53:21 - WARNING - Post Randomly Skipped...

2018-01-30 09:53:21 - WARNING - Post Randomly Skipped...

2018-01-30 09:53:21 - INFO - New link found...
2018-01-30 09:53:21 - INFO - [2 posts liked /52 amount]
2018-01-30 09:53:21 - INFO - {{{---REMOVED FOR ANONYMITY---}}}
2018-01-30 09:53:25 - INFO - {{{---REMOVED FOR ANONYMITY---}}}
2018-01-30 09:53:32 - INFO - Session ended - 2018-01-30 09:53:32
2018-01-30 09:53:32 - INFO - --------------------

bad fix:
comment log_followers_num() call at instapy/instapy.py
good fix:
graphql call

Thank you.

I only understand the "bad fix", so I will start there.

I tried the 'bad fix' without success. The script exited randomly (twice) after modifying line 260 of instapy.py

#log_follower_num(self.browser, self.username, self.logfolder)

@HermanoCrespo what麓s the error output ?

File "bot-script.py", line 111, in
schedule.run_pending()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 493, in run_pending
default_scheduler.run_pending()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 78, in run_pending
self._run_job(job)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 131, in _run_job
ret = job.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/schedule/__init__.py", line 411, in run
ret = self.job_func()
File "bot-script.py", line 64, in job
session.like_by_tags(likeTagInLoop, amount=like_count) # execute liking functionality
File "/Users/sepp/User-TYEbi/instapy/instapy.py", line 689, in like_by_tags
self.logger)
File "/Users/sepp/User-TYEbi/instapy/like_util.py", line 483, in check_link
"return window._sharedData.entry_data."
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 543, in execute_script
'args': converted_args})['value']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'entry_data' of undefined
(Session info: headless chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.1 x86_64)

bad fix:
comment log_followers_num() call at instapy/instapy.py
good fix:
graphql call

@converge hello.

I've tried the bad solution, but the result is that the script is running and telling me "1 Image Liked", but in reality, there isn't any like on the image.... it's just a false log.

I'm using the same configurations and scripts on 5 accounts, and only 1 account is not working anymore.... it's like the pages, that this particular account is navigating trough, are different from the others.... like it's using a different version of Instagram pages, so the script isn't locating correctly the objects.

How can I use the Graphql solution?

thank you very much.

aaaand same here!
screenshot - 03262018 - 10 06 45 am

`INFO [2018-03-26 07:20:56] [dexterforest] [41/120]
INFO [2018-03-26 07:20:56] [dexterforest] https://www.instagram.com/p/BgxxEV3lnvk/?tagged=dog
INFO [2018-03-26 07:22:41] [dexterforest] Image from: b'attila_thechamp'
INFO [2018-03-26 07:22:42] [dexterforest] Session ended - 2018-03-26 07:22:42
INFO [2018-03-26 07:22:42] [dexterforest] --------------------

Traceback (most recent call last):
File "dexterforestbot.py", line 80, in
schedule.run_pending()
File "/usr/local/lib/python3.5/dist-packages/schedule/__init__.py", line 493, in run_pending
default_scheduler.run_pending()
File "/usr/local/lib/python3.5/dist-packages/schedule/__init__.py", line 78, in run_pending
self._run_job(job)
File "/usr/local/lib/python3.5/dist-packages/schedule/__init__.py", line 131, in _run_job
ret = job.run()
File "/usr/local/lib/python3.5/dist-packages/schedule/__init__.py", line 411, in run
ret = self.job_func()
File "dexterforestbot.py", line 56, in job
session.like_by_tags(keywords, amount=liknum, interact=False)
File "/root/DF/instapy/instapy.py", line 874, in like_by_tags
self.logger)
File "/root/DF/instapy/like_util.py", line 482, in check_link
"return window._sharedData.entry_data."
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'entry_data' of undefined
(Session info: headless chrome=65.0.3325.181)
(Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.4.0-116-generic x86_64)
`

also, maaaaaaybe, just maaaaybe it might be worth notice the link that the script was trying to read:
here
the first caracter of the description is "鈿狅笍"

Was this page helpful?
0 / 5 - 0 ratings