Instapy: Cannot read property 'owner' of undefined

Created on 17 Apr 2017  路  7Comments  路  Source: timgrossmann/InstaPy

Was running the code perfectly. then ran it today, and this message showed up.

Any clue? I don't know what to do

Traceback (most recent call last): File "C:/Users/houseDIJAMCO/AppData/Local/Programs/Python/Python36/example.py", line 63, in <module> amount=100) File "C:\Users\houseDIJAMCO\AppData\Local\Programs\Python\Python36\instapy\instapy.py", line 235, in like_by_tags self.username, self.like_by_followers_upper_limit, self.like_by_followers_lower_limit) File "C:\Users\houseDIJAMCO\AppData\Local\Programs\Python\Python36\instapy\like_util.py", line 59, in check_link user_name = browser.execute_script("return window._sharedData.entry_data.PostPage[0].media.owner.username") File "C:\Users\houseDIJAMCO\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 484, in execute_script 'args': converted_args})['value'] File "C:\Users\houseDIJAMCO\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 249, in execute self.error_handler.check_response(response) File "C:\Users\houseDIJAMCO\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'owner' of undefined (Session info: chrome=57.0.2987.133) (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.14393 x86_64)

Most helpful comment

working on it

All 7 comments

Instagram changed the site.
user_name = browser.execute_script("return window._sharedData.entry_data.PostPage[0].media.owner.username") image_text = browser.execute_script("return window._sharedData.entry_data.PostPage[0].media.caption")
no longer points to the same place

working on it

Time to refactor the code and think in a better way of get the elements.

Edit: in two of my accounts this JS method still works.

@vlntdds,

really? for me it changed everything to the new graphql...
I've made a PR for it but, since some accounts still use the old one we need to treat both scenarios.

They probably roll out changes incrementally to a % of their user population.

I guess that once we do the "big" refactor and move all click/browse functions together it will be easier to maintain.

should be solved by #132 and #145

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harrypython picture harrypython  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

Spyd3r0us picture Spyd3r0us  路  3Comments

ediooo picture ediooo  路  3Comments

converge picture converge  路  3Comments