Liking, commenting and following based on tags. I can still unfollow users, it still navigates to the accounts, tags and locations that I feed in, but exits when it gets to the individual urls of the photos. Have run pip install instapy --upgrade.
Entire program exits when it comes to the liking and commenting stage for multiple methods (Like by Tags, Like by Locations, Like by Likers, Follow Followers).
Gives the following error: Traceback (most recent call last):
File "Good commenting strategy & new QS system.py", line 178, in <module>
run()
File "Good commenting strategy & new QS system.py", line 139, in run
session.like_by_locations(['213385402/london-united-kingdom/','217908612/camden-town/'], amount=100)
File "C:\Users\username\Documents\InstaPy-master\InstaPy-master\instapy\instapy.py", line 1244, in like_by_locations
self.logger)
File "C:\Users\username\Documents\InstaPy-master\InstaPy-master\instapy\like_util.py", line 473, in check_link
''', user_name)
File "C:\Installs\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\Installs\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Installs\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'edges' of undefined
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17763 x86_64)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'edges' of undefined
`session.set_dont_like(['kids', 'kid', 'nsfw','kidsgymnastics','kidsart','activitiesforkids', 'balletforkids', 'artforkids','kidseducation','rip', 'accident',
'instamemorials', 'gonebutneverforgotten', 'gonetoosoon', 'pet'])
session.set_do_follow(enabled=True, percentage=15, times=1)
session.set_do_comment(enabled=False, percentage=80)
session.set_user_interact(amount=1, randomize=False, percentage=100)
session.like_by_locations(['213385402/london-united-kingdom/','217908612/camden-town/'], amount=100)
session.follow_by_locations(['224442573'], amount=5, skip_top_posts=False)
#session.interact_user_followers(target_userlist, amount=25, randomize=True)
#session.follow_likers(target_userlist, photos_grab_amount = 2, follow_likers_per_photo = 10, randomize=True, sleep_delay=600, interact=False)
session.set_comments(igtv_comments,
media='Photo')
session.set_blacklist(enabled=True, campaign='onlyonce')
session.set_do_like(True, percentage=100)
#session.set_delimit_liking(enabled=True, max=100, min=0)
#session.set_delimit_commenting(enabled=True, max=40, min=0)
session.set_relationship_bounds(enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=50000,
max_following=50000,
min_followers=100,
min_following=100)
session.set_quota_supervisor(enabled=True, sleep_after=["likes", "server_calls"], sleepyhead=True, stochastic_flow=True, notify_me=True,
peak_server_calls=(400, 6000),
peak_likes=(100, 1000),
peak_comments=(100, 1000),
peak_follows=(100, None))`
sees like the Instagram might doing some A/B testing again by changed their graph structure.
we will need to see how many affected, sometimes it just temporary.
Same problem here with this Error Traceback:
Traceback (most recent call last):
File "quickstart.py", line 37, insession.like_by_tags(["randomtag","randomtag2"], amount=3)
File "/home/paul/InstaPy/instapy/instapy.py", line 1617, in like_by_tags
self.logger)
File "/home/paul/InstaPy/instapy/like_util.py", line 475, in check_link
''', user_name)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script
'args': converted_args})['value']File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read property 'edges' of undefined
(Session info: headless chrome=73.0.3683.86)
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.20.16-200.fc29.x86_64 x86_64)
I can report the same issue.
Same here
Same here
As @CharlesCCC pointed out already, instagram/fb folks changed the api. The following change helped me to fix the issue:
like_util.py, line 459:
replace:
latest_comments = window._sharedData.entry_data.PostPage[0].graphql.shortcode_media.edge_media_to_comment.edges;
with
latest_comments = window._sharedData.entry_data.PostPage[0].graphql.shortcode_media.edge_media_preview_comment.edges;
and line 502:
image_text = media['edge_media_to_comment']['edges']
with
image_text = media['edge_media_preview_comment']['edges']
As @CharlesCCC pointed out already, instagram/fb folks changed the api. The following change helped me to fix the issue:
like_util.py, line 459:
replace:latest_comments = window._sharedData.entry_data.PostPage[0].graphql.shortcode_media.edge_media_to_comment.edges;
with
latest_comments = window._sharedData.entry_data.PostPage[0].graphql.shortcode_media.edge_media_preview_comment.edges;
Thank you very much! fixed it for me ;-) Maybe commit to main repo and close issue?
@vicmosin Good catch, Although I didn't noticed anything changed for my account. (It like all of my accounts are still running fine without issue).
Yeah, that's actually the reason I did not create PR yet.. not sure whether it's temporary or permanent change
similar issue here
Traceback (most recent call last):
File "like_by_tag_interact_unfollow.py", line 110, in
amount=1000, media='Photo')
File "C:ITCGit_hubInstaPy-masterinstapyinstapy.py", line 1480, in like_by_tags
self.logger)
File "C:ITCGit_hubInstaPy-masterinstapylike_util.py", line 469, in check_link
''', user_name)
File "C:anaconda3envsinstagramlibsite-packagesseleniumwebdriverremotewebdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:anaconda3envsinstagramlibsite-packagesseleniumwebdriverremotewebdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:anaconda3envsinstagramlibsite-packagesseleniumwebdriverremoteerrorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'edges' of undefined
(Session info: headless chrome=72.0.3626.121)
(Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 10.0.17134 x86_64)
Thanks @vicmosin, that edit worked for me.
Thanks @vicmosin! That worked for me.
@vicmosin Hi, I can't seem to find this piece of code in the like_util.py. What I can see at line 475 in like_util.py is:
def get_media_edge_comment_string(media):
"""AB test (Issue 3712) alters the string for media edge, this resoves it"""
options = ['edge_media_to_comment', 'edge_media_preview_comment']
for option in options:
try:
media[option]
except KeyError:
continue
return option
Looks like it's trying both, edge_media_to_comment and edge_media_preview_comment but I still get the same error here. I installed instapy using pip and also ran an upgrade. Didn't work.
@shashgupta I am not sure, maybe mine fork is too old.. but you could try to replace every occurrence of edge_media_to_comment
with edge_media_preview_comment
(or remove one from the array i.e. options = ['edge_media_preview_comment']
). This just an assumption though
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
As @CharlesCCC pointed out already, instagram/fb folks changed the api. The following change helped me to fix the issue:
like_util.py, line 459:
replace:
with
and line 502:
with