docs/settings.md
This method is only needed for the interact_by_... actions.
Posts will be liked by default when using like_by_... actions.
# ~70% of the by InstaPy viewed posts will be liked
session.set_do_like(enabled=True, percentage=70)
# enable comments (by default enabled=False) and set commenting probability to 25% so ~ every 4th image will be commented on
session.set_do_comment(enabled=True, percentage=25)
# Configure a simple list of optional comments, one will be selected at random when commenting:
session.set_comments(['Awesome', 'Really Cool', 'I like your stuff'])
Or configure conditional comments to provide a more contextual commenting based on the caption of the image: Conditional comments are created as a list of dictionaries, each one contains a definition of mandatory words and a list of comments. The list of conditional comments is scanned until the first item that satisfies the mandatory words condition is found and then one of the comments associated with that item is selected at random to be used. This can best be understood with an example:
comments=[
# either "icecave" OR "ice_cave" will satisfy this:
{'mandatory_words': ["icecave", "ice_cave"], 'comments': ["Nice shot. Ice caves are amazing", "Cool. Aren't ice caves just amazing?"]},
# either "high_mountain" OR ("high" AND "mountain") will satisfy this:
{'mandatory_words': ["high_mountain", ["high", "mountain"]], 'comments': ["I just love high mountains"]},
# Only ("high" AND "tide" together) will satisfy this:
{'mandatory_words': [["high", "tide"]], 'comments': ["High tides are better than low"]}
# Only "summer" AND ("lake" OR "occean") will satisfy this:
{'mandatory_words': [["summer", ["lake", "occean"]]], 'comments': ["Summer fun"]}
]
session.set_comments(comments)
You can also set comments for specific media types (Photo / Video)
session.set_comments(['Nice shot!'], media='Photo')
session.set_comments(['Great Video!'], media='Video')
# and you can add the username of the poster to the comment by using
session.set_comments(['Nice shot! @{}'], media='Photo')
To use an emoji just add an u in front of the opening apostrophe:
session.set_comments([u'This post is 🔥',u'More emojis are always better 💯',u'I love your posts 😍😍😍']);
# or
session.set_comments([u'Emoji text codes are also supported :100: :thumbsup: :thumbs_up: \u2764 💯💯']);
Emoji text codes are implemented using 2 different naming codes. A complete list of emojis codes can be found on the Python Emoji Github, but you can use the alternate shorted naming scheme found for Emoji text codes here. Note: Every Emoji has not been tested. Please report any inconsistencies.
# default enabled=False, follows ~ 10% of the users from the images, times=1
# (only follows a user once (if unfollowed again))
session.set_do_follow(enabled=True, percentage=10, times=2)
# Generate smart hashtags based on https://displaypurposes.com ranking,
# banned and spammy tags are filtered out.
# (limit) defines amount limit of generated hashtags by hashtag
# (sort) sort generated hashtag list 'top' and 'random' are available
# (log_tags) shows generated hashtags before use it
# (use_smart_hashtags) activates like_by_tag to use smart hashtags
session.set_smart_hashtags(['cycling', 'roadbike'], limit=3, sort='top', log_tags=True)
session.like_by_tags(amount=10, use_smart_hashtags=True)
Generate smart hashtags based on https://displaypurposes.com/map ranking. Banned and spammy tags are filtered out.
Use_smart_location_hashtags activates like_by_tag to use smart hashtags
session.set_smart_location_hashtags(['204517928/chicago-illinois', '213570652/nagoya-shi-aichi-japan'], radius=20, limit=10)
session.like_by_tags(amount=10, use_smart_location_hashtags=True)
radius: Radius around the location in Miles
limit: Defines amount limit of generated hashtags by hashtag
log_tags: Shows generated hashtags before use it (default is True)
<ins class="adsbygoogle" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4875789012193531" data-ad-slot="9530237054"
</ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
session.set_quota_supervisor(enabled=True,
sleep_after=["likes", "comments_d", "follows", "unfollows", "server_calls_h"],
sleepyhead=True,
stochastic_flow=True,
notify_me=True,
peak_likes_hourly=57,
peak_likes_daily=585,
peak_comments_hourly=21,
peak_comments_daily=182,
peak_follows_hourly=48,
peak_follows_daily=None,
peak_unfollows_hourly=35,
peak_unfollows_daily=402,
peak_server_calls_hourly=None,
peak_server_calls_daily=4700)
enabled: put True to activate or False to deactivate supervising any time
If you don't want to supervise likes at all, simply remove peak_likes parameter OR use peak_likes=(None, None).
Once likes reach peak, it will jump every other like, yet, will do all available actions (e.g. follow or unfollow).
server calls does not jump, it exits the program once reaches the peak.Although, you can put server calls to sleep once reaches peak, read
sleep_afterparameter.
sleep_after: is used to put InstaPy to sleep after reaching peak rather than jumping the action (or exiting- for server calls)
Any action can be included ["likes", "comments", "follows", "unfollows", "server_calls"].
As if you want to put sleep only after reaching hourly like peak, put "likes_h" OR put "likes_d" for sleeping only after reaching daily like peak.
such as,
sleep_after=['follows_h'] will sleep after reaching hourly follow peaksleep_after=['likes_d', 'follows', 'server_calls_h'] will sleep after reaching daily like peak, follow peaks (hourly and daily) and hourly server call peak.Notice: there can be either "likes" (for both hourly and daily sleep) OR "likes_h" (for hourly sleep only) OR "likes_d" (for daily sleep only).
Once gone to sleep, it will wake up as new hour/day (according to the interval) arrives AND continue the activity.
sleepyhead: can help to sound more humanly which will wake up a little bit later in a randomly chosen time interval around accurate wake up time.
e.g., if remaining time is
17minutes, it will sleep20minutes instead (random values each time)..
stochastic_flow: can provide smooth peak value generation by your original values.
e.g., your peak likes hourly is
45, next hour that peak will be39, the next43, etc.
notify_me: sends toast notifications (directly to your OS) about the important states of supervisor- sleep, wake up and exit messages.
session.set_quota_supervisor(enabled=True, peak_comments_daily=21, peak_comments_hourly=240)
That's it! When it reaches the comments peak, it will just jump all of the comments and will again continue to put comments when is available [in the next hour/day].
"server_calls_h" into sleep_after parametersleepyhead=True parametersession.set_quota_supervisor(enabled=True, peak_server_calls_daily=490, sleep_after=["server_calls_h"], sleepyhead=True)
It will sleep after hourly server calls reaches its peak given -
490and never allow one more extra request to the server out of the peak and wake up when new hour comes in WHILST daily server calls will not be supervised at all- as Alicia wishes.
notify_me parameterpre-defined peak values [at close range] each new hour/day: uses stochastic_flow=True parameter"follows_h" and "unfollows_d"into sleep_after parametersession.set_quota_supervisor(enabled=True, peak_follows_daily=560, peak_follows_hourly=56, peak_unfollows_hourly=49, peak_unfollows_daily=550, sleep_after=["follows_h", "unfollows_d"], stochastic_flow=True, notify_me=True)
Big Hint: Find your NEED 🤔 and supervise it!
session.set_dont_like(['#exactmatch', '[startswith', ']endswith', 'broadmatch'])
.set_dont_like searches the description and owner comments for hashtags and
won't like the image if one of those hashtags are in there
You have 4 options to exclude posts from your InstaPy session:
# will match only exact hashtags (e. g. #cat matches #cat, but not #catpic)[ will match all hashtags starting with your word (e. g. [cat matches #catpic, #caturday and so on)] will match all hashtags ending with your word (e. g. ]cat matches #mycat, #instacat and so on)cat will match #cat, #mycat, #caturday, #rainingcatsanddogs and so on)# will ignore the don't like if the description contains
# one of the given words
session.set_ignore_if_contains(['glutenfree', 'french', 'tasty'])
# completely ignore liking images from certain users
session.set_ignore_users(['random_user', 'another_username'])
# will prevent commenting on and unfollowing your good friends (the images will
# still be liked)
session.set_dont_include(['friend1', 'friend2', 'friend3'])
session.set_mandatory_words(['#food', '#instafood'])
.set_mandatory_words searches the description, location and owner comments for words and
will like the image if the mandatory words condition is met.
The mandatory words list can be a simple list of words or a nested structure of lists within lists.
For example:
# either "icecave" or "ice_cave" will satisfy this:
["icecave", "ice_cave"]
# either "high_mountain" OR ("high" AND "mountain") will satisfy this:
["high_mountain", ["high", "mountain"]]
# Only ("high" AND "tide" together) will satisfy this:
[["high", "tide"]]
# Only "summer" AND ("lake" OR "occean") will satisfy this:
[["summer", ["lake", "occean"]]
session.set_mandatory_language(enabled=True, character_set=['LATIN'])
session.set_mandatory_language(enabled=True, character_set=['LATIN', 'CYRILLIC'])
.set_mandatory_language restrict the interactions, liking and following if any character of the description is outside of the character sets you selected (the location is not included and non-alphabetic characters are ignored). For example if you choose LATIN, any character in Cyrillic will flag the post as inappropriate. If you choose 'LATIN' and 'CYRILLIC', any other character sets will flag the post as inappropriate as well.
LATIN, GREEK, CYRILLIC, ARABIC, HEBREW, CJK, HANGUL, HIRAGANA, KATAKANA and THAI# Prevents unfollow followers who have liked one of your latest 5 posts
session.set_dont_unfollow_active_users(enabled=True, posts=5)
# Controls your interactions by campaigns.
# ex. this week InstaPy will like and comment interacting by campaign called
# 'soccer', next time InstaPy runs, it will not interact again with users in
# blacklist
# In general, this means that once we turn off the soccer_campaign again, InstaPy
# will have no track of the people it interacted with about soccer.
# This will help you target people only once but several times for different campaigns
session.set_blacklist(enabled=True, campaign='soccer_campaign')
session.set_do_comment(True, percentage=50)
session.set_comments(['Neymar is better than CR7', 'Soccer is cool'])
session.like_by_tags(['soccer', 'cr7', 'neymar'], amount=100, media='Photo')
<ins class="adsbygoogle" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4875789012193531" data-ad-slot="9530237054"
</ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
To turn off simulation or to decrease its occurrence frequency, use set_simulation setting:
#use the value of `False` to permanently turn it off
session.set_simulation(enabled=False)
#use a desired occurrence percentage
session.set_simulation(enabled=True, percentage=66)
session.set_skip_users(skip_private=True,
private_percentage=100,
skip_no_profile_pic=False,
no_profile_pic_percentage=100,
skip_business=False,
skip_non_business=False,
business_percentage=100,
skip_business_categories=[],
dont_skip_business_categories=[],
skip_bio_keyword=[],
mandatory_bio_keywords=[],
skip_public=False,
public_percentage=0)
This is done by default
session.set_skip_users(skip_private=True,
private_percentage=100)
Will skip users that have private account, even if are followed by running account. You can set a percentage of skipping: private_percentage= 100 always skip private users private_percentage= 0 never skip private users (so set skip_private=False)
session.set_skip_users(skip_private=False,
skip_public=True,
public_percentage=100)
Will skip users that have public account. You can set a percentage of skipping: private_percentage= 100 always skip public users private_percentage= 0 never skip public users (so set skip_public=False)
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
no_profile_pic_percentage=100)
Will skip users that haven't uploaded yet a profile picture You can set a percentage of skipping: no_profile_pic_percentage= 100 always skip users without profile picture no_profile_pic_percentage= 0 never skip users without profile picture (so set skip_no_profile_pic=False)
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True,
business_percentage=100)
This will skip all users that have business account activated. You can set a percentage of skipping: business_percentage= 100 always skip business users business_percentage= 0 never skip business users (so set skip_business=False)
N.B.: This business_percentage parameter works only if no skip_business_categories or dont_skip_business_categories are provided!
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True,
skip_business_categories=['Creators & Celebrities'])
This will skip all business accounts that have category in given list N.B. In skip_business_categories you can add more than one category
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True,
dont_skip_business_categories=['Creators & Celebrities'])
This will skip all business accounts except the ones that have a category that matches one item in the list of dont_skip_business_categories N.B. If both dont_skip_business_categories and skip_business_categories, InstaPy will skip only business accounts in the list given from skip_business_categories.
A list of all available business categories can be found here
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True,
skip_non_business=True,
dont_skip_business_categories=['Creators & Celebrities'])
This will skip all non business and business accounts except categories in dont_skip_business_categories.
session.set_skip_users(skip_bio_keyword=["lifestyle"],
mandatory_bio_keywords=["art", "photography"])
This will skip users that have "lifestyle" and users that don't have "art" or "photography" in their bio or username. See the Mandatory Words section for details on how to define complex mandatory words conditions.
<ins class="adsbygoogle" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4875789012193531" data-ad-slot="9530237054"
</ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
session.set_delimit_liking(enabled=True, max_likes=1005, min_likes=20)
Use enabled=True to activate and enabled=False to deactivate it, any time
max is the maximum number of likes to compare
min is the minimum number of likes to compare
You can use both max & min values OR one of them as you desire, just put the value of
Noneto the one you don't want to check for., e.g.,
session.set_delimit_liking(enabled=True, max_likes=242, min_likes=None)
at this configuration above, it will not check number of the existing likes against minimum value
session.set_delimit_liking(enabled=True, max_likes=500, min_likes=7)
Now, if a post has more existing likes than maximum value of 500, then it will not like that post,
similarly, if that post has less existing likes than the minimum value of 7, then it will not like that post...
session.set_delimit_commenting(enabled=True, max_comments=32, min_comments=0)
Use enabled=True to activate and enabled=False to deactivate it, any time
max is the maximum number of comments to compare
min is the minimum number of comments to compare
You can use both max & min values OR one of them as you desire, just leave it out or put it to
Noneto the one you don't want to check for., e.g.,
session.set_delimit_commenting(enabled=True, min_comments=4)
# or
session.set_delimit_commenting(enabled=True, max_comments=None, min_comments=4)
at this configuration above, it will not check number of the existing comments against maximum value
session.set_delimit_commenting(enabled=True, max_comments=70, min_comments=5)
Now, if a post has more comments than the maximum value of 70, then it will not comment on that post,
similarly, if that post has less comments than the minimum value of 5, then it will not comment on that post...
This feature is helpful when you want to comment only on specific tags.
session.set_delimit_commenting(enabled=True, comments_mandatory_words=['cat', 'dog'])
This will only comment on posts that contain either cat or dog in the post description or first comment. You can also require sets of words. See the Commenting section for detains on how to do that
session.set_relationship_bounds(enabled=True,
potency_ratio=1.34,
delimit_by_numbers=True,
max_followers=8500,
max_following=4490,
min_followers=100,
min_following=56,
min_posts=10,
max_posts=1000)
Use enabled=True to activate this feature, and enabled=False to deactivate it, any time
delimit_by_numbers is used to activate & deactivate the usage of max & min values
potency_ratio accepts values in 2 formats according to your style: positive & negative
potency_ratio with POSITIVE values can be used to route interactions to only potential (real) users WHOSE followers count is higher than following count (e.g., potency_ratio = 1.39)
find desired potency_ratio with this formula: potency_ratio == followers count / following count (use desired counts)e.g., target user has
5000followers &4000following and you setpotency_ratio=1.35. Now it will not interact with this user, cos the user's relationship ratio is5000/4000==1.25and1.25is below desiredpotency_ratioof1.35
potency_ratio with NEGATIVE values can be used to route interactions to only massive followers WHOSE following count is higher than followers count (e.g., potency_ratio = -1.42)
find desired potency_ratio with this formula: potency_ratio == following count / followers count (use desired counts)e.g., target user has
2000followers &3000following and you setpotency_ratio = -1.7. Now it will not interact with this user, cos the user's relationship ratio is3000/2000==1.5and1.5is below desiredpotency_ratioof1.7(note that, negative-sign is only used to determine your style, nothing more)
potency_ratio or not (e.g., potency_ratio=None, delimit_by_numbers=True) - will decide only by your pre-defined max & min values regardless of the potency_ratiosession.set_relationship_bounds(enabled=True, potency_ratio=None, delimit_by_numbers=True, max_followers=22668, max_following=10200, min_followers=400, min_following=240)
potency_ratio (e.g., potency_ratio=-1.5, delimit_by_numbers=False) - will decide per potency_ratio regardless of the pre-defined max & min valuessession.set_relationship_bounds(enabled=True, potency_ratio=-1.5, delimit_by_numbers=False, max_followers=400701, max_following=90004, min_followers=963, min_following=2310)
apparently, once
delimit_by_numbersgetsFalsevalue, max & min values do not matter
potency_ratio and pre-defined max & min values together (e.g., potency_ratio=2.35, delimit_by_numbers=True) - will decide per potency_ratio & your pre-defined max & min valuessession.set_relationship_bounds(enabled=True, potency_ratio=2.35, delimit_by_numbers=True, max_followers=10005, max_following=24200, min_followers=77, min_following=500)
All of the 4 max & min values are able to freely operate, e.g., you may want to only delimit
max_followersandmin_following(e.g.,max_followers=52639,max_following=None,min_followers=None,min_following=2240)
session.set_relationship_bounds(enabled=True, potency_ratio=-1.44, delimit_by_numbers=True, max_followers=52639, max_following=None, min_followers=None, min_following=2240)
session.set_relationship_bounds(min_posts=10,
max_posts=1000)
Users that have more than 1000 posts or less than 10 will be discarded
N.B.: It is up to the user to check that min_posts < max_posts
You can also set only one parameter at a time:
session.set_relationship_bounds(max_posts=1000)
Will skip only users that have more than 1000 posts in their feed
set_action_delays setting!session.set_action_delays(enabled=True,
like=3,
comment=5,
follow=4.17,
unfollow=28,
story=10)
Now it will sleep 3 seconds after putting every single like, 5 seconds for every single comment and similarly for the others..
You can also customize the sleep delay of e.g. only the likes:
session.set_action_delays(enabled=True, like=3)
random_range_from and random_range_toBy just enabling randomize parameter, you can enjoy having random sleep delays at desired range, e.g.,
session.set_action_delays(enabled=True, like=5.2, randomize=True, random_range_from=70, random_range_to=140)
There, it will have a random sleep delay between 3.64 (70% of 5.2) and 7.28(140% of 5.2) seconds each time after putting a like.
random_range_from=None, random_range_to=200
Then, the min range will automatically be 100%- the same time delay itself.
And the random sleep delays will be between 5.2 and 10.4 seconds.random_range_from=70, random_range_to=None
Then, the max range will automatically be 100%- the same time delay itself.
And the random sleep delays will be between 3.64 and 5.2 seconds.None to both min & max ranges as- random_range_from=None, random_range_to=None
Then no randomization will occur and the sleep delay will always be 5.2 seconds.random_range_from=100, random_range_to=70?
No worries. It will automatically take the smaller number as min and the bigger one as max.0 for the random_rage percentages.
E.g. random_range_from=-10, random_range_to=140 is an invalid range and no randomization will happen.random_range_from=70.7, random_range_to=200.45 will work greatly.safety_match parameter.session.set_action_delays(enabled=True, like=0.15, safety_match=False)
It has been held due to safety considerations. Cos sleeping a respective time after doing actions- for example ~10 seconds after an unfollow, is very important to avoid possible temporary blocks and if you might enter e.g. 3 seconds for that without realizing the outcome...
For example:
# Like posts based on hashtags
hashtags = session.target_list("C:\\Users\\......\\hashtags.txt")
session.like_by_tags(hashtags, amount=10)
# Follow the followers of each given user
users = session.target_list("C:\\Users\\......\\users.txt")
session.follow_user_followers(users, amount=10, randomize=False)
Note that your text file should look like this:
hashtag1
hashtag2
hashtag3
or
user1
user2
user3
Functions you can use target_list with:
story_by_user, story_by_tag, like_by_tags, follow_by_tags, follow_user_followers, follow_user_following, follow_likers, follow_commenters, follow_by_list, set_skip_users, set_ignore_users, set_dont_include, interact_by_users, interact_by_users_tagged_posts, interact_user_followers, interact_user_following, interact_by_comments, set_comments, set_comment_replies, set_mandatory_words, unfollow_users