Booting script, should work!
receiving error: selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'graphql' of undefined
Didn't make any changes at all. Was working just fine, went to run the script again and have been getting this error.
looks like instagram.com might have changed their data structure again. i'm having the same issue, looking into it.
Same issue here
@CharlesCCC I was going to look into this as well. Have you reduced the search area for what may be causing the issue at all? Thanks, whatever information you have would be helpful.
Based off initial research, their (Instagram.com) removed the graphql
from the entry_data
entirely if you logged in. but apparently the data still there if you don't login and just visit the profile page ?(strange). we need figure out another way to grab those data.
I've solved the first problems changing this line, please check this out:
line 11 from instapy/print_log_writer.py
"return window._sharedData.""entry_data.ProfilePage[0]."
to
"return window._sharedData.""entry_data.ProfilePage."
But after the login and firsts steps seems to fall again here:
instapy/like_util.py", line 438, in check_link graphql = 'graphql' in post_page[0]
@joanroig that won't work, I tried that already. after you logged in, the "ProfilePage" just disappeared from the page.
this is what I see after I logged in
"supports_es6":true,
"country_code":"US",
"language_code":"en",
"locale":"en_US",
"entry_data":{
"FeedPage":{
"graphql":null
}
},
@CharlesCCC mine seems to work fine step by step, changing those [0] to non-arrays, I'm also changing this code from instapy/like_util.py:
graphql = 'graphql' in post_page[0]
if graphql:
media = post_page[0]['graphql']['shortcode_media']
to
graphql = 'graphql' in post_page
if graphql:
media = post_page['graphql']['shortcode_media']
Seems like there are no more post_page and ProfilePage arrays there.
Looks like there will be possible solution:
<a class="_t98z6 " href="/followers/"><span class="_fd86t " title="14,153">14.1k</span> followers</a>
graphql
in the not logged in profile page forever). @CharlesCCC I got the quickstart.py working right now using my code posted before, I'll try to commit my changes after a quick review.
@joanroig thank you for the quick fix. I believe this fix might work on some people. because my two account doesn't have the entry_data
after logged in.
I currently have to remove the line that will grab that information to get it going.
find a old piece of code might actually helped with my issue, not sure why is get changed with the new version:
try:
followed_by = browser.execute_script(
"return window._sharedData.""entry_data.ProfilePage."
"graphql.user.edge_followed_by.count")
except WebDriverException: #handle the possible `entry_data` error
try:
browser.execute_script("location.reload()")
followed_by = browser.execute_script(
"return window._sharedData.""entry_data.ProfilePage."
"graphql.user.edge_followed_by.count")
except WebDriverException:
followed_by = None
@CharlesCCC seems strange to me 馃槪 @robpettinato please check if my last pull request works for you too.
@joanroig it fails for me. The obvious difference for me is I am interacting with a User's followers vs the quickstart.
Edit: I didn't see the full breadth of your changes. Pulling from your commit and testing now.
@craigricker some options tested right now, I've added my tested features in the pull request description. I hope this solves your issues too, mine seems to work like before again :)
Edit: Pull request re-referenced again from my branch 'master', I was on the wrong one.
@joanroig pulling from your most recent commit (d82f706) from this does not fix my issues sadly! But I am glad you are up and running.
@craigricker please clone my forked repo and check it again:
https://github.com/joanroig/InstaPy
Probably you need to refresh your .pyc compiled files, otherwise please copy paste your issue here.
how do you troubleshoot this problem ?
@joanroig currently working, thanks! I believe you are right, it was related to the .pyc files being refreshed properly.
@craigricker I'm glad to listen that :) @loopypanda just pick the code changes from this pull request:
https://github.com/timgrossmann/InstaPy/pull/1940
@joanroig working for me, thx!
hi guys,
actually, before latest update, graphql dictionary
was in the first list
of PostPage (_may/would apply to FeedPage and others, too_) entry.
But now, that list is removed and we no more need the index of [0]
It's a good catch @joanroig, awesome!
_There is one more thing, too, did this update hit entire or partial userbase?_
@joanroig Just tested your changes and they work for me. Ty.
@uluQulu probably partial user for now. (consider their huge user base) it might take sometime to get the change deployed cross all of their servers.
Seems like the [0] is back again, can anyone look for it please?
Yes @joanroig, I checked,
Now I think, @CharlesCCC, if there will be a change, it will possibly apply to all as it is so easy to switch changes at no time
I don't have this update yet.
Good to know you all getting those fails before I do lol si I can prepare (geo update probably)
Me too i dont have anything !
@timgrossmann Instagram will probably switch again using the index [0], I think we can have a branch with my last changes to switch if the list removal is definitive.
Issues solved by reverting the last adaption to Instagram changes:
https://github.com/timgrossmann/InstaPy/pull/1954
I think it solves all of these open issues:
https://github.com/timgrossmann/InstaPy/issues/1953
https://github.com/timgrossmann/InstaPy/issues/1952
https://github.com/timgrossmann/InstaPy/issues/1951
https://github.com/timgrossmann/InstaPy/issues/1949
https://github.com/timgrossmann/InstaPy/issues/1946
https://github.com/timgrossmann/InstaPy/issues/1944
Here is my branch without the [0] that we mentioned, @timgrossmann shall we make this branch for the future? Otherwise we can check the code from the previous commit, I hope there will be no more changes for now 馃槄
@joanroig it is so strange why Instagram change back and forth on this ? (Ideally, for each of those location we should check both scenario like the following approach), so we don't need switch back and forth on each branch:
try:
followed_by = browser.execute_script(
"return window._sharedData.""entry_data.ProfilePage."
"graphql.user.edge_followed_by.count")
except WebDriverException: #handle the possible `entry_data` error
try:
browser.execute_script("location.reload()")
followed_by = browser.execute_script(
"return window._sharedData.""entry_data.ProfilePage[0]."
"graphql.user.edge_followed_by.count")
except WebDriverException:
followed_by = None
Maybe this is how they tests bots? since they fail the right after page layout changes ?
@CharlesCCC yes I think it will be the best method, these days I have no time to check all code and make a pull request while checking that nothing is broken, I hope anyone else can do it so.
Probably they've tested a new version that will be live in some days...
@joanroig just wanted to let you know I've committed your fork and updated instapy.py with:
def like_by_feed(self, kwargs):
"""Like the users feed"""
for i in self.like_by_feed_generator(kwargs):
pass
return self
and it's working great.
Moltes merces!!!
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
Most helpful comment
@timgrossmann Instagram will probably switch again using the index [0], I think we can have a branch with my last changes to switch if the list removal is definitive.