Instapy: Confusion about Interact=True

Created on 14 May 2018  路  6Comments  路  Source: timgrossmann/InstaPy

Expected Behavior @uluQulu

Another newb question:
Bot to interact with people that it follows through "Follow commenters of photos" or "Follow likers of photos"
I am struggling with this part:

You can also interact with the followed users by enabling interact=True which will use the configuration of set_user_interact setting:

I do not understand, where to define, what kind of interaction will take place. Simply setting this to "True" results in no change in behavior of the bot.
How to set the bot to also interact with people I follow by using "Follow commenters of photos" or "Follow likers of photos" so that the bot also likes their pictures and comments and how to chose, which comments to post.

Current Behavior

Setting Interact=True does nothing, the Bot simply follows users.

Possible Solution (optional)

InstaPy configuration

    # settings
    session.set_user_interact(amount=3,
                 percentage=32,
                  randomize=True,
                   media='Photo') 
    session.follow_commenters(['user1'], amount=10, daysold=10, max_pic=7, sleep_delay=60, interact=True)  

Thank you in advance for your help!

Most helpful comment

Well @positivez,
Whichever feature you see having interact parameter, be sure that it uses the configuration of set_user_interact setting:

set_user_interact(amount=10, percentage=100, randomize=False, media='Photo')

And it just sets aside, amount of interactions, percentage of occurences, and randomized interactions, and types of media to interact. Nothing more, nothing less.

And for you to be able to do interactions, e.g. likes, you must enable likes in its own setting:

set_do_like(enabled=True, percentage=70)

For also commenting after liking:

set_do_comment(enabled=True, percentage=10)
set_comments(comments=['cool', 'dope'], media='Photo')

Well, you have just set aside all possible interaction types for follow_likers and/or follow_commenters features: _likes_ & _comments_ (_it will interact only after following a user, and since unfollowing is not an interaction type, those 2 guys are the only interaction types xD_)
And you should know that starting settings before actions is a famous rule, so make sure your quickstart script looks like this:

##settings
session.set_do_like(enabled=True, percentage=70)

session.set_do_comment(enabled=True, percentage=10)
session.set_comments(comments=['cool', 'dope'], media='Photo')

session.set_user_interact(amount=10, percentage=100, randomize=False, media='Photo')

##actions
session.follow_commenters(['user1'], amount=10, daysold=10, max_pic=7, sleep_delay=60, interact=True)

All 6 comments

Well @positivez,
Whichever feature you see having interact parameter, be sure that it uses the configuration of set_user_interact setting:

set_user_interact(amount=10, percentage=100, randomize=False, media='Photo')

And it just sets aside, amount of interactions, percentage of occurences, and randomized interactions, and types of media to interact. Nothing more, nothing less.

And for you to be able to do interactions, e.g. likes, you must enable likes in its own setting:

set_do_like(enabled=True, percentage=70)

For also commenting after liking:

set_do_comment(enabled=True, percentage=10)
set_comments(comments=['cool', 'dope'], media='Photo')

Well, you have just set aside all possible interaction types for follow_likers and/or follow_commenters features: _likes_ & _comments_ (_it will interact only after following a user, and since unfollowing is not an interaction type, those 2 guys are the only interaction types xD_)
And you should know that starting settings before actions is a famous rule, so make sure your quickstart script looks like this:

##settings
session.set_do_like(enabled=True, percentage=70)

session.set_do_comment(enabled=True, percentage=10)
session.set_comments(comments=['cool', 'dope'], media='Photo')

session.set_user_interact(amount=10, percentage=100, randomize=False, media='Photo')

##actions
session.follow_commenters(['user1'], amount=10, daysold=10, max_pic=7, sleep_delay=60, interact=True)

Hi @uluQulu

That actually makes a lot of sense and works like a charm. Thank you so much once more, keep up the good work! :)

@uluQulu Hello. Thanks for the example code. I want to ask you how the code is structured and how the actions are working. Does the order of the settings mater? For example you first did like, then comment and then user interact. If you change that to first user interact and then like comment in the settings, will this make any difference?

Also the action will follow the settings? So will it go to a post follow a commentor, then like image, and comment or first will go to the commentor, like comment and then follow?

What i am trying to understan here is the structure the way instapy works. I want for example user interact user followers. But the default settings make first like post, then follow and then instapy moves to the profile to like and interact with the user. I want the following at the end after instapy likes a post, moves to the profile and interacts and at the end to follow.

I coundt find any explanation about the sturcture of the settings? If you can explain i will be really happy.

Why is the settings structure like in your example, and will changing the structure affect the action.

Thanks.

Hi @imbarismustafa
All python rules apply in InstaPy.
And since InstaPy is fully linear, all of the code is being executed at the exact order they are written.

And the question you had is understandable- "_does it make difference if I change the order of writing settings_"?
Well, the structure says: DO WHATEVER YOU WANT before STARTS THE ACTION- which means, the action will consider all of the settings written before itself. And will not know about the existence of the settings after it.

And having known it, you should also know that the settings' duties are almost unique and they do not conflict.
One last thing is, regardless of the write order of the settings, the features' (_actions'_) has their own use of the settings and and they do not care if one setting was started before the other. All they care is "_Was That Setting Started At All_"?

_I think this post will address most of the questions in your mind, but saying again, it is a pure python and is a fully linear program (_not using any threads, yet_) and by knowing this, you can clear many other questions in mind._

Hint: If you want to change the order of activities (e.g. _liking > following > commenting_ instead of _liking > commenting > following_), just start to modify the respective feature's core file(s) in your needs.

Cheers

@uluQulu Thank you for the quick and informative reply.
You mention "regardless of the write order of the settings,the features' (actions') has their own use of the settings and and they do not care if one setting was started before the other".

So if my settings are like the following:
session.set_user_interact...
session.set_do_like...
session.set_do_follow---

and my action are like:
session.interact_user_followers...

Does that mean that because "(actions') has their own use of the settings" i can not change the order of the action(the structure of the interaction). Because no matter the order of the settings, user interact always likes one image, then follows the user and likes two more images. In total thats 3 images liked because i specified in the setting the amount to be 3. But i want to control the order of the interaction, meaning the follow action to be last.

Thank you.

It's a pleasure @imbarismustafa
Yes that's right.
I have included answer to this question in previous post
"_Hint: If you want to change the order of activities (e.g. liking > following > commenting instead of liking > commenting > following), just start to modify the respective feature's core file(s) in your needs._"

If you want to change the order of the activities, you have to modify it do so by editing source of that feature.
What you desire is kind of structure sampling by the order of settings started and it is very rare idea and is highly difficult and not-so-efficient :D
Cos the current steps are always written with the most effective styles (_at least they were intended to_) but if you have a better idea, style of the order of activities, change that mechanism and it may help other people, too, if it is more efficient style :_)

Good luck! (_Ask me anything_)

Was this page helpful?
0 / 5 - 0 ratings