Instapy: Follow_User_Followers not interacting with users

Created on 22 May 2018  路  8Comments  路  Source: timgrossmann/InstaPy

After the major code update that was made to change how follow_user_followers and follow_user_following fundamentally function, I have been unable to get the program to interact with users as they are followed. I have currently concluded that the updated program is not pulling from the interact function correctly as I have tested this with this code (the media parameters not working is being tracked in a separate issue):

session.set_do_comment(enabled=True, percentage=100)
session.set_comments(['comment1', 'comment2', 'comment3'], media='Photo')
session.set_comments(['comment4', 'comment5', 'comment6'], media='Video')
session.set_user_interact(amount=1, randomize=False, percentage=100)

session.follow_user_followers(['user'], amount=5, randomize=False, interact=True, sleep_delay=600)

I set the comment and interact percentages to 100% so that the program would like/comment on every user photo during the test run and it did not comment on any while following.

@uluQulu were there any other missing parameters related to this issue that should be added to make the code interact with users?

Thank you!

Most helpful comment

Confirmed @uluQulu 's suggested code change from main to article makes this function interact correctly after following. Closing the issue!

All 8 comments

@jeremycjang
Earlier those changes, those features could not have on-the-go interactions but now they can.
I have used interact_by_users method to do the standalone interactions for them.
And for particularly follow_user_followers feature, it will consider to interact only after following a user.
So you have 2 interaction types available: _likes_ and _comments_

Fine, and in interact_by_users feature, it does try to comment only after liking a picture which is I like and which is you are missing.
You have not defined set_do_like in your quickstart script in order to handle _liking_ and if it is not defined, self.do_like stays in disabled state, so it will not like any picture, that means will not also comment, too regardless of the commenting is disabled or enabled.
What you could do is defining set_do_like in your quickstart script.

I set the comment and interact percentages to 100% so that the program would like/comment on every user photo during the test run and it did not comment on any while following.

And from those words, I think you also want to like, so adding the missing set_do_like will be okay.
_I said this cos there are people who would want to comment without liking and it is not how interact_by_users work and that kind of commenting is pretty annoying and inefficient, that's why I specifically chose interact_by_users._

Read https://github.com/timgrossmann/InstaPy/issues/2019#issuecomment-388889341 for more.

@uluQulu That makes sense; I think previously the do.like function did not exist, or at the least I had never used it while using the legacy follow_user_followers.

I confirmed that adding this enabled the program to interact after following a user; I also agree with you that commenting without liking a post is not a good approach

Thank you so much for the quick response!

Hi @uluQulu , after further testing with the GUI running, I've noticed that the interact code is encountering an issue in which it is trying to open an account link from the suggested user list that appears after a new user is followed instead of opening the a post link to interact with, resulting in the Image not liked: Unavailable Page message. I have randomize=False so the program should be selecting the user's latest post. Perhaps something in the code needs to be adjusted?

Example messages to explain my observations:

INFO [2018-05-22 15:16:11] [InstaPyuser]  ---> Now following: FollowedUser
INFO [2018-05-22 15:16:11] [InstaPyuser]  --> FollowedUser added to blacklist for black_list campaign (action: followed)
INFO [2018-05-22 15:16:16] [InstaPyuser]  Username [1/1]
INFO [2018-05-22 15:16:19] [InstaPyuser]  --> FollowedUser
INFO [2018-05-22 15:16:19] [InstaPyuser]  Getting FollowedUser image list...
INFO [2018-05-22 15:16:39] [InstaPyuser]  Interaction begin...
INFO [2018-05-22 15:17:24] [InstaPyuser]  Post [1/1]
INFO [2018-05-22 15:17:24] [InstaPyuser]  https://www.instagram.com/SuggestedUser/
WARNING [2018-05-22 15:17:33] [InstaPyuser]  Unavailable Page: https://www.instagram.com/SuggestedUser/
INFO [2018-05-22 15:17:33] [InstaPyuser]  --> Image not liked: Unavailable Page
INFO [2018-05-22 15:17:33] [InstaPyuser]  -------------
INFO [2018-05-22 15:17:33] [InstaPyuser]  --> Given amount not fullfilled, image pool reached its end

INFO [2018-05-22 15:17:33] [InstaPyuser]  Liked: 0
INFO [2018-05-22 15:17:33] [InstaPyuser]  Already Liked: 0
INFO [2018-05-22 15:17:33] [InstaPyuser]  Commented: 0
INFO [2018-05-22 15:17:33] [InstaPyuser]  Inappropriate: 1
INFO [2018-05-22 15:17:33] [InstaPyuser]  Not valid users: 0

I will also continue testing this without GUI to see if the issue persists with nogui=True.

Update: While testing with nogui=True, the program currently still does not properly open a post to interact but instead displays a message >> Self-Aborting Prevented.

What is difference between

session.follow_user_followers(user_to_interact, amount=10, randomize=True, interact=True)

and

session.set_do_follow(enabled=True, percentage=100)
session.interact_user_followers(user_to_interact, amount=10, randomize=True)

Awesome @jeremycjang
It's a great catch!
And it was happening cos those suggested users' href link is also tagged as an a element.

To solve, open up like_util.py file and find get_links_for_username definition and there apply this modification:
replace

# Get Links
main_elem = browser.find_element_by_tag_name('main')

with

# Get Links
main_elem = browser.find_element_by_tag_name('article')

_we changed main to article_

Now it will grab only the links of posts.

@uluQulu Thank you! Will continue testing with this modification in a few days to confirm its function before closing

Teamwork makes the dream work 馃

@ceribbo
That's a smart of you to realize it! 馃寴
A few weeks back follow_user_followers and follow_user_followers did not have interaction capabilities.
But with the latest changes, now they have full support for on-the-go interactions.
Interstingly, that same question puzzled my mind while revising interact_user_followers and interact_user_following after it.

First I also thought now they have the same capabilities, that's why we should aggregate a pair of them and have a cleaner feature set. But well, they have slightly different functionalities. 馃寳

follow_user_followers and follow_user_followers will consider to interact only after following a user whilst interact_user_followers and interact_user_following will interact regardless of following a user;
  • So you can have these combinations with interact_user_followers and interact_user_following :
    follow only 35%, like 85%, comment 12%

_where it will attempt to interact all with all of the users and apply those interactions when available_

  • But with follow_user_followers and follow_user_followers, you have no follow percentage option, it will either follow a user or not (_if not valid_) and if followed a user and if interact==True, it will try to interact- like and/or comment according to your pre-defined percentages.

_So, both feature sets are useful in their own scope._ 馃寲

Confirmed @uluQulu 's suggested code change from main to article makes this function interact correctly after following. Closing the issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

awesome205 picture awesome205  路  71Comments

bjspi picture bjspi  路  64Comments

GreatTimeBand picture GreatTimeBand  路  114Comments

drogon34 picture drogon34  路  73Comments

CamiloB picture CamiloB  路  316Comments