Closed espipj closed 5 years ago
Is it working manually from the web? Don't change windows size.
Just catch the same problem today and I'm not sure if the problem has been there already for some time!
After changing the setup from Chrome to Firefox, both Headless!
I can confirm for a normal run (like_by_tags()...): -> Image liked! (NOT working) -> Commented "..." (working) -> Now following (NOT working)
instapy (on Firefox) has also problem with UNFOLLOWING. It's simply not working!
Hey @davidrocket I think UNFOLLOWING is actually working, but as It didnt actually followed fails in "unfollowing" as you cannot unfollow a profile you are not following ;) (if you follow (manually web/app one of the "false" following logged on the script, it will do the unfollow)
Which is the config where you are running the script in? Raspberry Pi? Has it worked before on Chrome in the RasPi? I might consider switching.
@sionking yes, its working manually from the web for sure. I had to change windows size in the instapy.py file as the script was throwing an "out of bounds exception", similar to #803
Unfollowing shows me this error on Firefox, with:
session.unfollow_users(amount=count, onlyInstapyFollowed=False, onlyInstapyMethod='FIFO'))
Will raise the following error:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //div[text()='Following']/following-sibling::div
If Chrome is in used instead of Firefox with the same version of instapy, selenium and python, UNFOLLOWING will work!
UNFOLLOWING works now with Firefox (after tweaking around :) )! despite having this ERROR shown:
ERROR - set_automated_followed_pool error list index out of range
This Error indicates, this line failed:
with open('./logs/' + username + '_followedPool.csv') as \ followedPoolFile:
in my case, I actually dont have the file "username_followedPool.csv"... @converge After the file was created, it has its "row[0]" EMPTY, so the ERROR keeps raising! I hope, you guys with more insight can fix it easily! Thanks...
To Fix "Like"-Problem, please replace the line 537 in like_util.py with this line
like_elem[0].click()
Tested and works!
To Fix "Follow"-Problem, please replace the line 347 in unfollow_util.py with this line
follow_button.click()
Tested and works!
Hey @davidrocket Could you explain what environment are you using? (firefox/chrome, headless?, gecko driver version, selenium version, python version)
I'll test those fixes you say and give you feedback this weekend. ;)
@davidrocket You were right! It's working right now. I suggest @timgrossmann to change it but ¿it may not work in other environments?
Changing in these lines .send_keys("\n")
by .click()
:
https://github.com/timgrossmann/InstaPy/blob/master/instapy/unfollow_util.py#L341
https://github.com/timgrossmann/InstaPy/blob/master/instapy/like_util.py#L537
For these 2 particular usecases, there will be no problem in any environment, as the items are clickable objects.
send_keys event can be used in place where text, images are put in and there are a predefined event-handler for "\n"-key.
Guys: please change the xpath selector of 'Like'-element in like_util.py at the following line:
"//a[@role='button']/span[text()='Like']/..")
to
"//a[@role='button']/span[text()='Like']")
@davidrocket , did you find a solution to the followedPool.csv issue?
Try not to overwrite (keep) the instapy/db folder every time you update instapy to newer version!
we need to overwrite database everytime we have database improvements, write new code to non existent database table is not a good idea.
We will also have inconsistent database of instagram account, when the one old overwritten by the new "but empty" one! I would try avoid replacing the older database files if they do still work!
you will only overwrite your database if you don´t what you´re doing.
Let do some additional elaboration in what you want to say... Without looking into the code, one can say, It makes nosense to have a database for runtime, then being replaced by the new empty one!
@davidrocket thank you very much for the solutions!! I would like to ask you how did u tweak around the code to solve the issue of unfollowing
I am stucked wih the following error that you mentioned: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //div[text()='Following']/following-sibling::div
What did you write instead of div[text()='Following']/following-sibling::div
Thank you very much beforehand!!
:)
Guys, I actually solve the problem somehow on my own branch! But it was a month at least... But a hint to the community is, please try to remove quotes (single, double) from your comments list, and do a check if they work! As I guess, the place where the instapy stops, is when it tries to put a comment on the media!
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
I'm having this issue since the first execution. The script goes through the tags, picks photos, check if the user is appropiate (sometimes it isnt) and likes (follows 10% of them). It says "Image Liked" or "Now following" but when I go to Instagram browser or app the image/profile is not actually liked/followed.
I've gone further in my tests, after the script ends I run it again, but before of that I follow manually from mobile any of the users "supposedly followed" (not actually). The script starts unfollowing the list of follows of the previous execution, most of them arent followed so it catches the error unfollowing, but the one/s I followed manually prints by the log the unfollow, and the unfollow shows in the app/browser as well (unfollow works).
I dont really know what the problem is.
I'm running it headless+firefox+gecko on a Raspberry Pi 3 (same IP as my Mobile/PC) if it helps.
And the script I'm running is:
InstaPy(username='', password='',nogui=True, use_firefox=True, page_delay=25)\ .set_switch_language(False)\ .login()\ .set_do_comment(True, percentage=0) \ .set_comments(['Cool!', 'Awesome!', 'Nice!']) \ .set_do_follow(enabled=True, percentage=15, times=2) \ .set_dont_like(['food', 'girl', 'hot','NSFW']) \ .unfollow_users(amount=10, onlyInstapyFollowed = True, onlyInstapyMethod = 'FIFO', sleep_delay=60 ) \ .set_upper_follower_count(limit=1500) \ .set_lower_follower_count(limit = 110) \ .like_by_tags(['traveler','canon'], amount=18) \ .end()