@uluQulu Had the idea to introduce a folder with a list of examples every new and already advanced user of InstaPy can use to get some idea about what other people use.
This way, we might also be able to see what works best and who has really creative ways for using InstaPy.
Feel free to contribute your quickstart file, just make sure to remove any personal information.
Would love to see a lot of new PRs from people who are using InstaPy.
If you don't want to create a PR, you can either ask for help, I'd be happy to help you!
You can also simply send your quickstart.py to contact.[email protected] and I'll add it for you or post it as a comment into this issue.
Thank you for this incredible community
All the best
Tim
Perfect, @timgrossmann!
You've imagined it better than I thought 🎉 [template] term suits much better here!
@fgisslen @jeremycjang @tompicca @lucanello @meinert @cormo1990 @aku6640 @zsvendo @the-unknown @redsector72 @bianpratama @tachenz @aleeepp @johnvfitness @marcomokastyle @torbenberger @ardysan2012 @mehran @GabrieleCalarota @dbmathis @hermanocrespo @loopypanda @nocturnal-2 @darokif @edhim @mmorte @sevilyilmaz @dimisaev @skylimity @ortegafernando @franklinclinton @wisdomlocker @riccardorighettiphoto @danielsemmelrock @underclass @samille @clevebounce and many others,
I expect from all of you at least one stylish _quickstart template_ 😎 to be shared with the community- be it a light-weight example or a super advanced python code!
I myself will also share my mostly used style 😂 (_needs a cleanup_)
@timgrossmann for the ease of process, I think people may also share it right in this thread [so that we can PR it in some free time].
Also, collaborators should share more than 1 style, eh? 🤓
_Once this idea works, then the efficiency will boom 🎊 think about it - 1
mind vs 5k
minds_.
Happy to be of at least limited use to this amazing community @uluQulu :)
Mine is used in combination with putting a 40 sec sleep delay after every like the script does.
So then it runs 24/7 at rather slower speed, but without problems (so far). Would interact with user followers, liking 3 pictures, doing 1-2 comment - and 25% chance of follow (ratios which work the best for my account):
from instapy import InstaPy
import os
session = InstaPy(username=' ', password='')
session.login()
session.set_user_interact(amount=3, randomize=True, percentage=100, media='Photo')
session.set_relationship_bounds (enabled=True, potency_ratio=None, delimit_by_numbers=True, max_followers=3000, max_following=900, min_followers=50, min_following=50)
session.set_simulation(enabled=False)
session.set_do_like(enabled=True, percentage=100)
session.set_ignore_users(['])
session.set_do_comment(enabled=True, percentage=35)
session.set_do_follow(enabled=True, percentage=25, times=1)
session.set_comments(['])
session.set_ignore_if_contains([])
session.interact_user_followers([], amount=340)
session.end()
Happy to be of at least limited use to this amazing community @uluQulu :)
Mine is used in combination with putting a 40 sec sleep delay after every like the script does.
So then it runs 24/7 at rather slower speed, but without problems (so far). Would interact with user followers, liking 3 pictures, doing 1-2 comment - and 25% chance of follow (ratios which work the best for my account):from instapy import InstaPy
import os
session = InstaPy(username=' ', password='')
session.login()
session.set_user_interact(amount=3, randomize=True, percentage=100, media='Photo')
session.set_relationship_bounds (enabled=True, potency_ratio=None, delimit_by_numbers=True, max_followers=3000, max_following=900, min_followers=50, min_following=50)
session.set_simulation(enabled=False)
session.set_do_like(enabled=True, percentage=100)
session.set_ignore_users(['])
session.set_do_comment(enabled=True, percentage=35)
session.set_do_follow(enabled=True, percentage=25, times=1)
session.set_comments(['])
session.set_ignore_if_contains([])
session.interact_user_followers([], amount=340)
session.end()
I think your template is the answer to what I've always wanted to achieve with my own template but unlucky so far (still got great results tho).
This would probably be the best temp for new accounts to start slowly and gently and then as your account gather Insta authority, you could put some more power to your temp/bot
Special thanks to @timgrossmann and @uluQulu
That's enough! time to go testing lol..
@Tachenz Thank you very much for sharing.
Your script as of now, does not incorporate any custom sleep_delays. Could you please update your code to resemble that concept?
Do you use time.sleep
or are you using the built in sleep_delay
parameters?
Would love to have it in the folder as a template.
Thanks
Best
Tim
@timgrossmann @Tachenz This is similar to something I've been trying to get to work using schedule, so that the script only runs during 'working hours', say 9-5, but never works successfully.
Is this something that could be built into sleep_delay
as a parameter to add into the config file?
@uluQulu @timgrossmann This is a good idea! Thanks for your continuous contributions!
@uluQulu Thanks for including me!
Here is my InstaPy settings. I have added some explanations on why I use this. I think it is good opportunity to educate and get educated :)
I am an one month old InstaPy user, with a small following. So my numbers in settings are bit conservative.
""" Start of parameter setting """
# don't like if a post already has more than 150 likes
session.set_delimit_liking(enabled=True, max=150, min=0)
# don't comment if a post already has more than 4 comments
session.set_delimit_commenting(enabled=True, max=4, min=0)
""" I used to have potency_ratio=-0.85, max_followers=1200 for set_relationship_bounds()
Having a stricter relationship bound to target only low profiles users was not very useful,
as interactions/sever calls ratio was very low. I would reach the server call threshold for
the day before even crossing half of the presumed safe limits for likes, follow and comments (yes,
looks like quiet a lot of big(bot) managed accounts out there!!).
So I relaxed it a bit to -0.50 and 2000 respectively.
"""
session.set_relationship_bounds(enabled=True,
potency_ratio=-0.50,
delimit_by_numbers=True,
max_followers=2000,
max_following=3500,
min_followers=25,
min_following=25)
session.set_do_comment(True, percentage=20)
session.set_do_follow(enabled=True, percentage=20, times=2)
session.set_comments(['Amazing!', 'Awesome!!', 'Cool!', 'Good one!', 'Really good one'
'Love this!', 'Like it!', 'Beautiful!', 'Great!'])
session.set_sleep_reduce(200)
""" Get the list of non-followers
I duplicated unfollow_users() to see a list of non-followers which I run once in a while when I time
to review the list
"""
# session.just_get_nonfollowers()
# my account is small at the moment, so I keep smaller upper threshold
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=(100, 700),
peak_comments=(25, 200),
peak_follows=(48, 125),
peak_unfollows=(35, 400),
peak_server_calls=(None, 3000))
""" End of parameter setting """
""" Actions start here """
# Unfollow users
""" Users who were followed by InstaPy, but not have followed back will be removed in
One week (168 * 60 * 60)
Yes, I give a liberal one week time to follow :)
"""
session.unfollow_users(amount=25, InstapyFollowed=(True, "nonfollowers"), style="RANDOM",
unfollow_after=168 * 60 * 60,
sleep_delay=600)
# Remove specific users immediately
""" I use InstaPy only for my personal account, I sometimes use custom list to remove users who fill up my feed
with annoying photos
"""
# custom_list = ["sexy.girls.pagee", "browneyedbitch97"]
#
# session.unfollow_users(amount=20, customList=(True, custom_list, "all"), style="RANDOM",
# unfollow_after=1 * 60 * 60, sleep_delay=200)
# Like by tags
""" I mostly use like by tags. I used to use a small list of targeted tags with a big 'amount' like 300
But that resulted in lots of "insufficient links" messages. So I started using a huge list of tags with
'amount' set to something small like 50. Probably this is not the best way to deal with "insufficient links"
message. But I feel it is a quick work around.
"""
session.like_by_tags(['tag1', 'tag2', 'tag3', 'tag4'], amount=300)
@timgrossmann Yep. This way to run it is very critical on NOT trying to follow all the private users (as requests accumulate very fast). As hashtags are not used, but user followers - it feels like every second user script interacts with is private. And unfortunately, main version still can't skip those (or I was not able to). The one I am using, has a fix to skip private users, but I (shame on me) have forgotten where and when I did it. So I am afraid to change to the new one :))
PS. Just tried the last version - getting "plyer not found" error, and yes, back to problems with Private accounts.
As for the sleep delay, I just did this in like_util.py
if blacklist['enabled'] is True:
action = 'liked'
add_user_to_blacklist(
username, blacklist['campaign'], action, logger, logfolder
)
sleep(40)
return True
You're welcome, @Andercorp @Nocturnal-2
@Tachenz, the values in your script took my attention, it will be very good for new starters, as @Andercorp said. Stunning!
@Nocturnal-2, your template looks stylish, thanks for preparing it 🔝
You're one of the rare people I saw delimit liking and commenting 😉
@timgrossmann, for that sleep delay,
I saw some people recently in several threads who do [want to] add a custom [mainly larger] sleep delay after actions [e.g. follows] for several reasons [e.g. to prevent temporary block for them as they think].
For example some user want to put ~40 seconds of sleep delay after each follow [by default it is 3 seconds]
I mean people may want it, right. But for now, it can be done only by editing the core files.
Right now I refactor some bulk code around follow & unfollow engines and I think if you think it is feasible I can add an easy way to set custom sleep delays post [after] actions.
_E.g._,
session.set_delay_post_actions(enabled=True, likes=5, comments=None, follows=40, unfollows=20)
By that, people can now easily set custom sleep delays after doing actions. And if not used or any value is None
then it should sleep at default delay.
Also thinks of adding a minimum delay and custom delays below it should not be accepted.
If you like the idea, can you help to find a better naming for that [feature]- set_delay_post_actions()
and its parameters?
Also, cos of the action engines are unique, it will be too easy to implement that feature 💯
Keep posting quickstart templates 😁
Also, it is better to,
Hey guys, tried to make a PR. made a fork of instapy, made the pull request and merged but I guess I merged in into my own fork? lol? anyways here is my script that I'm using. Thanks again to @timgrossmann @uluQulu and all the contributors for all the hard work.
#this template is written by @boldestfortune
session.login()
# settings
#Just started playing around with quota supervisor, so I'm still tweaking these settings
session.set_quota_supervisor(enabled=True, peak_likes=(57, 585), peak_follows=(48, None), peak_unfollows=(35, 402), peak_server_calls=(500, None),
sleep_after=["server_calls_h"], sleepyhead=True, stochastic_flow=True, notify_me=True)
session.set_relationship_bounds(enabled=True,
potency_ratio=-1.3,
delimit_by_numbers=True,
max_followers=10000,
max_following=15000,
min_followers=75,
min_following=75)
session.set_do_comment(False, percentage=10)
session.set_comments(['aMEIzing!', 'So much fun!!', 'Nicey!'])
session.set_use_clarifai(enabled=True, api_key=)
session.clarifai_check_img_for(['nsfw', 'gay', 'hijab', 'niqab', 'religion', 'shirtless', 'fitness', 'yamaka', 'rightwing'])
session.set_dont_like(['dick', 'squirt', 'gay', 'homo', '#fit', '#fitfam', '#fittips', '#abs', '#kids', '#children', '#child', '[nazi', 'jew', 'judaism', '[muslim', '[islam', 'bangladesh','[hijab', '[niqab',
'[farright', '[rightwing', '#conservative', 'death', 'racist', ])
session.set_do_follow(enabled=True, percentage=25, times=2)
# actions
# i use smarthashtags, noticed some scripts in uploads using random and started using it myself
session.set_smart_hashtags(['interiordesign', 'artshow', 'restaurant', 'artist', 'losangeles', 'newyork', 'miami'], limit=10, sort='random', log_tags=True)
session.like_by_tags(amount=random.randint(1,15), use_smart_hashtags=True,)
session.set_dont_like(['promoter', 'nightclub'])
session.set_delimit_liking(enabled=True, max=1005, min=10)
session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.set_do_follow(enabled=True, percentage=70)
session.set_do_like(enabled=True, percentage=70)
session.set_comments([u"👍"])
session.set_do_comment(enabled=True, percentage=30)
session.interact_user_followers(['], amount=random.randint(1,10), randomize=True)
session.unfollow_users(amount=random.randint(30,100), InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=90*60*60, sleep_delay=501)
session.set_dont_unfollow_active_users(enabled=True, posts=3)
Thats it. open to all criticisms, and advice. Thanks again!
template.zip
@uluQulu Awesome idea with the custom sleeps for every feature.
I think this is something comparable to what @sionking mentioned a while ago, too.
Having global sleep delays for the user to adjust will be helpful.
I'd probably call it something like set_action_delays(...)
Just incredible that a lot of people are already participating!
Hopefully we'll see a huge templates folder, soon 😉
@boldestfortune Perfect!
I think you should see a proposal from GitHub to create a PR from your master branch into the master branch of this github repository.
It should work from there.
Thanks
Checkout my custom sleep delay settings and quickstart.py template #3046
@uluQulu Thank you for a very nice Idea. here is my quickstart just for follow/unfollow users.
# This Script created By @Mehran
# -*- coding: UTF-8 -*-
from instapy import InstaPy
import schedule
import time
import requests
from datetime import datetime
import os
from tempfile import gettempdir
from selenium.common.exceptions import NoSuchElementException
insta_username = ''
insta_password = ''
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=True,
nogui=True,
multi_logs=False)
def follow():
counter = 0
requests.get('https://api.telegram.org/******&text=🔔🔔🔔 InstaPy Follower Started @ {} 🔔🔔🔔'.format(datetime.now().strftime("%H:%M:%S"))) # Send notification to my Telegram
while counter <5:
counter += 1
try:
session.login()
# settings
session.set_relationship_bounds(enabled=True,
potency_ratio=1.21,
delimit_by_numbers=False,
max_followers=None,
max_following=None,
min_followers=None,
min_following=None)
session.follow_by_tags(['tehran','تهران'], amount=5)
session.follow_user_followers(['donya', 'arat.gym'], amount=5, randomize=False)
session.follow_by_tags(['کادو','سالن','فروشگاه','زنانه','فشن','میکاپ','پوست','زیبا'], amount=10)
session.follow_by_tags(['لاغری','خرید_آنلاین','کافی_شاپ','گل'], amount=5)
session.unfollow_users(amount=25, allFollowing=True, style="LIFO", unfollow_after=3*60*60, sleep_delay=450)
except:
import traceback
print(traceback.format_exc())
requests.get('https://api.telegram.org/*******&text=🔔🔔🔔 InstaPy Follower Stopped @ {} 🔔🔔🔔'.format(datetime.now().strftime("%H:%M:%S"))) # Send notification to my Telegram
def unfollow():
requests.get('https://api.telegram.org/*******/sendMessage?chat_id=*****&text=🔔 InstaPy UNFollower Started @ {} 🔔'.format(datetime.now().strftime("%H:%M:%S")))
try:
session.login()
# settings
session.set_relationship_bounds(enabled=False,
potency_ratio=1.21,
delimit_by_numbers=False,
max_followers=None,
max_following=None,
min_followers=None,
min_following=None)
# actionns
session.unfollow_users(amount=600, allFollowing=True, style="RANDOM", sleep_delay=450)
except:
import traceback
print(traceback.format_exc())
requests.get('https://api.telegram.org/******/sendMessage?chat_id=******&text=🔔 InstaPy UNFollower Stopped @ {} 🔔'.format(datetime.now().strftime("%H:%M:%S")))
def xunfollow():
requests.get('https://api.telegram.org/******/sendMessage?chat_id=******&text=🔔 InstaPy UNFollower WEDNESDAY Started @ {} 🔔'.format(datetime.now().strftime("%H:%M:%S")))
try:
session.login()
# settings
session.set_relationship_bounds(enabled=False,
potency_ratio=1.21,
delimit_by_numbers=False,
max_followers=None,
max_following=None,
min_followers=None,
min_following=None)
# actionns
session.unfollow_users(amount=1000, allFollowing=True, style="RANDOM", unfollow_after=3*60*60, sleep_delay=450)
except:
import traceback
print(traceback.format_exc())
requests.get('https://api.telegram.org/******/sendMessage?chat_id=******&text=🔔 InstaPy UNFollower WEDNESDAY Stopped @ {} 🔔'.format(datetime.now().strftime("%H:%M:%S")))
schedule.every().day.at("09:30").do(follow)
schedule.every().day.at("13:30").do(follow)
schedule.every().day.at("17:30").do(follow)
schedule.every().day.at("00:05").do(unfollow)
schedule.every().wednesday.at("03:00").do(xunfollow)
while True:
schedule.run_pending()
time.sleep(1)
@Mehran great use of telegram
I will post mine in a while, even if my quickstart is pretty simple because I basically run once a day like comment follow and unfollow, but I've made a system to control amount of likes and comments in the last hour and in the last 24 hours. Also I don't include usernames that are either following me or that I follow them when the script starts.
@uluQulu Sleep delay would be amazing! (given that each account, depending on the life time and previous bans - needs its own speed).
But also - skipping private accounts. There was a PR about it, but I understand it never made it?
The thing is - it is not a material occurrence, if you working with hashtags (as obviously script can not see any posts by private users). But in the scenario with following other account followers - you accumulate hundreds of unanswered requests in a matter of days.
@Tachenz The initial PR was not continued by the author so I created an issue #2939 for it.
@sionking created a PR with his changes but it's not exactly what I wrote in the issue.
So it's still open, there are still $100 on it.
First of all, i am so proud to be mentioned by @uluQulu and thank you again for all the support gived to me until now.
I don't want to automate comment and too much likes because i want to do this only for post that i really like the content so at the moment I only use the function follow/defollow.
I use two files "quickstart", one for follow and one for defollow.
i noticed that the most important thing is that the account from where I get followers has similar contents to mine in order to be sure that my content could be appreciated.
after the following step, i start the defollowing the user that don't followed me back.
at the end i clean my account defollowind all the user followed with InstaPy.
I hope that i explain well what i mean.
feel free to ask any question.
thanks to all for this awesome work
This is my simple but effective script.
from instapy import InstaPy
insta_username = ''
insta_password = ''
session = InstaPy(username=insta_username, password=insta_password, headless_browser=True, multi_logs=True)
session.login()
session.set_relationship_bounds(enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=6000,
max_following=3000,
min_followers=30,
min_following=30)
ammount_number=500
session.set_user_interact(amount=2, randomize=True, percentage=30, media='Photo')
session.unfollow_users(amount=126, nonFollowers=True, style="RANDOM", unfollow_after=42*60*60, sleep_delay=300)
session.set_do_like(enabled=True, percentage=100)
session.set_do_comment(enabled=True, percentage=5)
session.set_comments(['Nice shot! @{}', 'I love your profile! @{}', '@{} Love it!', '@{} :heart::heart:', '@{}:revolving_hearts::revolving_hearts:', '@{}:fire::fire::fire:'], media='Photo')
session.set_do_follow(enabled=False, percentage=0)
session.follow_user_followers(['chrisburkard','danielkordan'], amount=ammount_number, randomize=False, interact=True, sleep_delay=240)
"""Ending the script"""
# clears all the cookies, deleting you password and all information from this session
session.end()
@uluQulu thanks for inviting me! :-)
This is my template which includes the new QS system:
it includes a randomizer for my hashtags... with every run, it selects 10 random hashtags from the list.
I am using the bot headless on my vServer and proxy into a raspberry pi I have at home, to always use my home IP to connect to Instagram.
In my comments, I always ask for feedback, use more than 4 words and always have emojis.
My comments work very well, as I get a lot of feedback to my posts and profile visits since I use this tactic.
As I target mainly active accounts, I use two unfollow methods.
The first will unfollow everyone who did not follow back within 12h.
The second one will unfollow the followers within 24h.
#!/usr/bin/python2.7
import random
from instapy import InstaPy
import sys
reload(sys)
sys.setdefaultencoding('utf8')
hashtags = ['travelcouples', 'travelcommunity', 'passionpassport', 'travelingcouple', 'backpackerlife', 'travelguide', 'travelbloggers', 'travelblog','letsgoeverywhere', 'travelislife','stayandwander', 'beautifuldestinations', 'moodygrams', 'ourplanetdaily', 'travelyoga', 'travelgram', 'sunsetporn','lonelyplanet', 'igtravel', 'instapassport', 'travelling', 'instatraveling', 'travelingram', 'mytravelgram', 'skyporn', 'traveler', 'sunrise','sunsetlovers', 'travelblog','sunset_pics', 'visiting', 'ilovetravel', 'photographyoftheday', 'sunsetphotography', 'explorenature', 'landscapeporn', 'exploring_shotz', 'landscapehunter', 'colors_of_day', 'earthfocus', 'ig_shotz', 'ig_nature', 'discoverearth', 'thegreatoutdoors']
random.shuffle(hashtags)
my_hashtags = hashtags[:10]
session = InstaPy(username='xxx', password='xxx', proxy_address='xxx', proxy_port='xxxx', headless_browser=True)
session.login()
session.set_dont_like(['sad', 'rain', 'depression'])
session.set_do_follow(enabled=True, percentage=40, times=1)
session.set_do_comment(enabled=True, percentage=30)
session.set_comments([u'What an amazing shot! :heart_eyes: What do you think of my recent shot?', u'What an amazing shot! :heart_eyes: I think you might also like mine. :wink:', u'Wonderful!! :heart_eyes: Would be awesome if you would checkout my photos as well!', u'Wonderful!! :heart_eyes: I would be honored if you would checkout my images and tell me what you think. :wink:', u'This is awesome!! :heart_eyes: Any feedback for my photos? :wink:', u'This is awesome!! :heart_eyes: maybe you like my photos, too? :wink:', u'I really like the way you captured this. I bet you like my photos, too :wink:' ,u'I really like the way you captured this. If you have time, check out my photos, too. I bet you will like them. :wink:', u'Great capture!! :smiley: Any feedback for my recent shot? :wink:' , u'Great capture!! :smiley: :thumbsup: What do you think of my recent photo?'], media='Photo')
session.set_do_like(True, percentage=70)
session.set_delimit_liking(enabled=True, max=100, min=0)
session.set_delimit_commenting(enabled=True, max=20, min=0)
session.set_relationship_bounds(enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=3000,
max_following=2000,
min_followers=100,
min_following=50)
session.set_quota_supervisor(enabled=True, sleep_after=["likes", "follows"], sleepyhead=True, stochastic_flow=True, notify_me=True,
peak_likes=(100, 1000),
peak_comments=(21, 250),
peak_follows=(200, None))
session.set_user_interact(amount=1, randomize=False, percentage=40)
session.like_by_tags(my_hashtags, amount=60, media=None)
session.unfollow_users(amount=500, InstapyFollowed=(True, "nonfollowers"), style="FIFO", unfollow_after=12*60*60, sleep_delay=501)
session.unfollow_users(amount=500, InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=24*60*60, sleep_delay=501)
session.end()
For newbies, might I suggest that you also include more explicitly in the README what lines are essential to have for the function to run InstaPy?
Right now, sometimes by omitting lines the script is still fine, but it's behavior is unknown, because the default states are never mentioned in the README.
Additionally, it is confusing sometimes to have multiple of the same action within the script (because the directions often lump one chunk of commands for a particular use – the logic is not super clear when trying to combine multiple uses together). I'm unaware if duplicate commands are overwriting one another, or if they're both necessary to run each particular action.
Hello @uluQulu
i am using simple settings for my personnal account with a crontab each 3H, its been working since 5months with no problem :
# settings
session.set_relationship_bounds(enabled=False,
potency_ratio=-1.21,
delimit_by_numbers=True,
max_followers=4590,
max_following=5555,
min_followers=45,
min_following=77)
session.set_do_comment(True, percentage=50)
session.set_comments(['aMazing!', 'So cool!!', 'Nice!', 'wow looks nice!', 'this is awesome!'])
# actions
session.like_by_tags(['xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx', 'xxx'], amount=8, skip_top_posts=True)
Thanks @uluQulu ! Here's the configuration I use the most with some extra notes at the end :
import os
import time
from tempfile import gettempdir
from selenium.common.exceptions import NoSuchElementException
from instapy import InstaPy
insta_username = 'username'
insta_password = 'password'
# set headless_browser=True if you want to run InstaPy on a server
session = InstaPy(username=insta_username,
password=insta_password,
use_firefox=True,
page_delay=20,
bypass_suspicious_attempt=False,
nogui=False,
multi_logs=True)
try:
session.login()
# settings
# I don't use relationship bounds, but messed with it before and had some arbitrary numbers here
session.set_relationship_bounds(enabled=False,
potency_ratio=-1.21,
delimit_by_numbers=True,
max_followers=99999999,
max_following=5000,
min_followers=70,
min_following=10)
#Create a blacklist campaign to avoid bot interacting with users again. I never turn this off
session.set_blacklist(enabled=True, campaign='blacklist')
session.set_do_like(enabled=True, percentage=100)
session.set_do_comment(enabled=True, percentage=100)
session.set_comments([':thumbsup:', ':raising_hands:', 'comment3'], media='Photo')
session.set_comments(['comment4', ':smiling_face_with_sunglasses: :thumbsup:', ':comment6'], media='Video')
#session.set_dont_include(['friend1', 'friend2', 'friend3'])
session.set_dont_like(['#naked', '#sex', '#fight'])
session.set_user_interact(amount=1, randomize=False, percentage=50)
session.set_simulation(enabled=True)
# actions
# first follow user followers leaves comments on these user’s posts
session.follow_user_followers(['user1, 'user2', 'user3'], amount=125, randomize=False, interact=True, sleep_delay=600)
# second follow user follows doesn’t comment on users’ posts
session.follow_user_followers(['user4', 'user5’], amount=50, randomize=False, interact=False, sleep_delay=600)
# unfollow amount intentionally set higher than follow amount to catch accounts that were not unfollowed last run
# blacklist set to false as this seems to allow more users to get unfollowed for whatever reason
session.set_blacklist(enabled=False, campaign='blacklist')
session.unfollow_users(amount=1000, InstapyFollowed = (True,"all"), style = 'FIFO', unfollow_after=None, sleep_delay=600)
except Exception as exc:
# if changes to IG layout, upload the file to help us locate the change
if isinstance(exc, NoSuchElementException):
file_path = os.path.join(gettempdir(), '{}.html'.format(time.strftime('%Y%m%d-%H%M%S')))
with open(file_path, 'wb') as fp:
fp.write(session.browser.page_source.encode('utf8'))
print('{0}\nIf raising an issue, please also upload the file located at:\n{1}\n{0}'.format(
'*' * 70, file_path))
# full stacktrace when raising Github issue
raise
finally:
# end the bot session
session.end()
Notes:
A blacklist is used and never turned off so as to never follow the same user twice (unless their username is changed)
The program is set to follow 475 people because this is the largest amount I've found so far that can be followed, commented on and unfollowed successfully within 24 hours. This can be customized of course, but please let me know if anyone's found a larger amount that can be cycled in 24 hours~
Running this program every day, the program never actually follows a full 475 people because it doesn't grab enough links or grabs the links of people that have been followed already.
I still have never observed the media
parameter within set comments
do anything, so a random comment from the 6 gets picked regardless of the media type
For unknown reasons, the program will always prematurely end the unfollow portion without unfollowing everyone. More on this later
I use two follow_user_followers
sessions because I believe the comments I use are only well-received by the followers of users in the first follow_user_followers
action.
Linux protip: This is a really basic command line syntax that I learned yesterday, but less technical people may not have know about it as well. using &&
in terminal, you can chain InstaPy programs! if you send:
python InstaPyprogram1 && python InstaPyprogram2
The shell will interpret it as "Run the InstaPyprogram1, then once it successfully completes immediately run InstaPyprogram2". Knowing this, my workaround for the premature unfollow actions ending is to chain my template with another program that only has the unfollow code. There's no limit to how many programs you can chain with &&
, so you can use your imagination on what can be accomplished 😉
Hope this helps! Open to any feedback and improvements anyone can suggest 😄
Hello there!
I want to thank all for the participation in this 🔥 idea 👏🏼👏🏼👏🏼
Now it is time to merge those templates for InstaPy _fellas_ to benefit from.
Also, the templates have to contain one information, too:
"_What does [this] quickstart script aim to do?_"
at the very top of the file to help the reader easily understand its scope rather than reading whole script..
Whilst some templates are almost complete and very ready to merge, some needs small revision before adding.
I will try to reformat them in a good looking efficient format (_e.g. using smart_run()
rather than old style_) and add into a PR.
It would be great if somebody could help in that 😀
This is my starting point for a conservative approach: Interact with the audience of influencers in your niche with the help of _Target-Lists_ and _randomization_. For the ease of use most of the relevant data is retrieved in the upper part.
"""This script is targeting followers of similar accounts and influencers"""
# additional imports random amount for interactions
import random
from instapy import InstaPy
from instapy.util import smart_run
# login credentials
insta_username = 'username'
insta_password = 'password'
#GENERAL SETTINGS
# restrictions
dont_likes = ['#exactmatch', '[startswith', ']endswith', 'broadmatch']
ignore_users = ['user1', 'user2', 'user3']
# prevent commenting on and unfollowing your good friends (the images will still be liked)
friends = ['friend1', 'friend2', 'friend3']
# prevent posts that contain
ignore_list = []
# TARGET SETTINGS
# set similar accounts and influencers from your niche to target
targets = ['user1', 'user2', 'user3']
# skip all business accounts, except from list given
target_business_categories = ['category1', 'category2', 'category3']
# COMMENT SETTINGS
comments = ['comment1', 'comment2', 'comment3']
#LOGIN-DATA
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=True,
disable_image_load=True,
multi_logs=True)
with smart_run(session):
# HEY HO LETS GO
session.set_dont_include(friends)
session.set_dont_like(dont_likes)
session.set_ignore_if_contains(ignore_list)
session.set_ignore_users(ignore_users)
session.set_simulation(enabled=True)
session.set_relationship_bounds(enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=7500,
max_following=3000,
min_followers=25,
min_following=25,
min_posts=10)
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True,
dont_skip_business_categories=[target_business_categories])
session.set_user_interact(amount=3, randomize=True, percentage=80, media='Photo')
session.set_do_like(enabled=True, percentage=90)
session.set_do_comment(enabled=True, percentage=15)
session.set_comments([comments], media='Photo')
session.set_do_follow(enabled=True, percentage=40, times=1)
# TARGETING
# select users form a list of a predefined targets
number = random.randint(3, 5)
random_targets = targets
if len(targets) <= number:
random_targets = targets
else:
random_targets = random.sample(targets, number)
# interact with the chosen targets
session.follow_user_followers(random_targets, amount=random.randint(30,60), randomize=True, sleep_delay=600, interact=True)
# UNFOLLOW
# unfollow nonfollowers after one day
session.unfollow_users(amount=random.randint(75,100), InstapyFollowed=(True, "nonfollowers"), style="FIFO", unfollow_after=24*60*60, sleep_delay=600)
# unfollow all users followed by instapy after one week to keep the following-level clean
session.unfollow_users(amount=random.randint(75,100), InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=168*60*60, sleep_delay=600)
Have fun while optimizing for your purposes, Nuzzo
Alright there,
The templates are ready 🔥
I have re-formatted them in good looks, done all the requirements and ready to push ✈
You have explained a very good tactic, but can you also provide a code for it?
I have added your template file containing your notes and you can add the code to it easily.
Basic follow-unfollow activity.zip
You're right. Most times, the next function call will reset the values of its parameters in prior call. But I can't be sure cos some definitions has different handlers and might not reset all of the empty arguments.
It needs a big attentive look to find it out for whole features and write a few lines into the README, it might also need a revision,..
Shortly, consider it being reset by every call and it will be fine :)
I have edited your script a bit more cos you never ended sessions xD
It's bad for the computer, you need to release resources after using. In other words, if you will not use an object for a long time, just release it and regenerate as requested...
in your template above you wrote,
# code code
with smart_run(session):
session.login() # EXTRA PROCESS
# code code
but smart_run
function already logs in and ends the session automatically. You really don't need to login manually which will be an extra process.
In all scripts I used smart_run()
.
Soon I will add all of those templates shared by
@Mehran, @loopypanda, @boldestfortune, @Nuzzo235, @jeremycjang, @Edhim, @the-unknown, @cormo1990 (needs source code 😁), @Tachenz, @Nocturnal-2, @ZackVega
to my live PR for merge into the main repo.
They are not perfect, so right BUT the ideas [of usage] in those templates are so great.
That's why I thank you again each one-by-one 🙋🏼♂️ cos I will also benefit some of those ideas 😛
@uluQulu Sorry for my late reply, I was so busy at work.
Below I've attached my template; as written, this is a very basic template Follow/Unfollow but for me works good.
it can be developed and improved securely (EX: adding targeting).
feel free to ask me more.
thanks to all for the other great templates! can't wait to try some of them :)
@Nuzzo235 - did you get propper log using that quickstart template? I only get one log statement which is = INFO : session start.
I just learn to code now and I'd like to know how to make a proper log record hehe, is it something i can build in the quickstart?
thanks!
@Apao123 It works for me, but with a small change. In my post a small error had crept in, because of which two logins took place. Try to delete the line session.login()
after smart_run(session)
. As @uluQulu has already mentioned the _smart_run
function already logs in and ends the session automatically. You really don't need to login manually which will be an extra process._
I hope that helped.
@Nuzzo235 Great work! Really close to what I was looking for.
@Nocturnal-2 I also like your template for tags, very useful.
One question for both: Is there a simple way to combine both codes into one? It will be perfect!!!
session.set_comments([comments], media='Photo')
@Nuzzo235 I had to remove the brackets around [comments] in your template as it was giving me a format error (this has been captured and the solution pointed out in another issue, but I thought it would be helpful to update your template as many people might use it as I did).
Thanks!
Most helpful comment
Perfect, @timgrossmann!
You've imagined it better than I thought 🎉 [template] term suits much better here!
I will ask some of the greatest InstaPy pioneers whom I have known throughout Issues,
@fgisslen @jeremycjang @tompicca @lucanello @meinert @cormo1990 @aku6640 @zsvendo @the-unknown @redsector72 @bianpratama @tachenz @aleeepp @johnvfitness @marcomokastyle @torbenberger @ardysan2012 @mehran @GabrieleCalarota @dbmathis @hermanocrespo @loopypanda @nocturnal-2 @darokif @edhim @mmorte @sevilyilmaz @dimisaev @skylimity @ortegafernando @franklinclinton @wisdomlocker @riccardorighettiphoto @danielsemmelrock @underclass @samille @clevebounce and many others,
I expect from all of you at least one stylish _quickstart template_ 😎 to be shared with the community- be it a light-weight example or a super advanced python code!
I myself will also share my mostly used style 😂 (_needs a cleanup_)
@timgrossmann for the ease of process, I think people may also share it right in this thread [so that we can PR it in some free time].
Also, collaborators should share more than 1 style, eh? 🤓
_Once this idea works, then the efficiency will boom 🎊 think about it -
1
mind vs5k
minds_.Cheers 😋