Instapy: Losing followers instead of gaining

Created on 5 May 2018  路  9Comments  路  Source: timgrossmann/InstaPy

I'm not sure this is a "code" issue or if it's how I am running it. I seem to be stuck at about 535 followers and can't seem to get past that. I was expecting the followers ceiling to be a bit higher than that.

I do nature photography and I'm shooting for about 2500 followers to start with.

I run the following on a cronjob "quickstart" 4 times a day. When I check the mail log for cron, I only seem to be following about 10 people per run and then more people unfollow me than I do get follows, so I am actually losing followers. My content is pretty good so this makes no sense.

How would I make the below better or is something else potentially wrong?

# set headless_browser=True if you want to run InstaPy on a server

# set these in instapy/settings.py if you're locating the
# library in the /usr/lib/pythonX.X/ directory:
#   Settings.database_location = '/path/to/instapy.db'
#   Settings.chromedriver_location = '/path/to/chromedriver'

session = InstaPy(username=insta_username,
                  password=insta_password,
                  headless_browser=False,
                  multi_logs=True)

try:
    session.login()

    # settings
    session.set_relationship_bounds(enabled=True,
                 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=10)
    session.set_comments(['Nicely done!', 'Nice!', 'Love it!', 'Nice one @{}!', 'Brilliant!', 'Nice @{}', 'Great photos!', 'Lovely!', 'Great shot @{}', 'Great Instagram page @{}', 'Nice job on your page @{}'])
    session.set_dont_include(['bbcearth', 'bbc', 'bbcspringwatch', 'agrayrock', 'kamzags', 'thehub_macro', 'sir_pinnington', 'syarina5292', 'dsparman', 'hubdirectory', 'globalfotografia_macro', 'tiknotantio', 'so_castilla', 'rt_6607', 'djankalwie', 'agirlnamedsnail', 'charlie_wild_life'])
    session.set_dont_like(['pizza', 'girl'])
    session.set_dont_unfollow_active_users(enabled=True, posts=20)
    # 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=12, times=2)

    session.like_by_tags(['birds', 'travel', 'wonderlust', 'adventure', 'birds_nature', 'insects', 'insects_macro','naturephotography', 'nature', 'mountains', 'naturelovers', 'outdoors', 'hiking', 'wildlife', 'wildlifephotography', 'outdoorphotography', 'photography', 'macrophotography', 'naturelovers', 'macro_captures', 'raw_insects', 'gf_macro', 'igbest_macros', 'masters_in_macro', 'total_macro', 'bns_macro', 'loves_united_macro', 'macro_kings', 'top_macro', 'excellent_macros', 'fuzzy_favorites', 'macro_captures', '25k_macro', 'insectguru'], amount=3)

    session.follow_by_tags(['birds', 'travel', 'wonderlust', 'adventure', 'birds_nature', 'insects', 'naturephotography', 'nature', 'mountains', 'naturelovers', 'outdoors', 'hiking', 'wildlife', 'wildlifephotography', 'outdoorphotography', 'photography', 'macrophotography', 'naturelovers', 'raw_insects', 'gf_macro'], amount=1)

    session.unfollow_users(amount=16, onlyInstapyFollowed = True, onlyInstapyMethod = 'FIFO', sleep_delay=600, unfollow_after=48*60*60)

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()

Most helpful comment

My pleasure @dbmathis,
Yes, exactly, as you use the program, it will record every followed user to that CSV file with a timestamp...
The reason it returned you 0 users to unfollow is you have set unfollow_after parameter for two days (48*60*60) and program cannot find any user followed before 2 days..
For now, I would recommend for you to either turn off unfollow_after parameter (_give unfollow_after=None or just remove it from function call_) or use other unfollow method, like onlyNotFollowMe and once you generate a good userbase in the CSV file after a few days, go back and use that parameter..

All 9 comments

Hey @dbmathis,
I wish I could help you cos I like nature photography a lot!
A few notes,

  1. If you are a starter and have not yet fully grabbed the features and specifications, I offer you to turn off potency_ratio for a while (potency_ratio=None) and stick to _max_ & _min_ values for now
  2. session.set_dont_unfollow_active_users(enabled=True, posts=20) 20 is a bit high, isn`t it?
  3. session.set_do_follow(enabled=True, percentage=12, times=2) 12% is a little low, increasing it would be good

But all you need is a good style, e.g., Follow+Like+Like+Like..
@cormo1990, can you share some efficient script for our friend?

Thanks @uluQulu

I will set the potency to None for now as you suggest.

I had posts=20 set to 20 because I wanted to give people a chance to like since I was posting about 3 per day. I figure someone might be on vacation or something. That way when it unfollows them, I know I gave them every chance to like a photo of mine. haha.

For session.set_do_follow, I never could figure out when this setting gets applied. Is it related to the session.follow_by_tags? I thought that session.follow_by_tags simply iterates though each tag that I have specified and follows a person from each tag amount=1 times. Where does percentage=12 come into play? What I really want the script to do is to follow X amount of people and then unfollow I about 110% of X in the same session. I am not clear what X should be though.

I am also open to the possibility that I have no clue how to configure this thing properly and in that case if someone has a similar focus on nature and has run a successful campaign I would be delighted if they could share configs..

There is one last thing that I see as potentially a huge red flag. I have been watching the log rolling to learn the behavior of the script and the script is following and then immediately unfollowing in the same session. That could be irritating people. Can this be avoided? I thought that this would take care of the problem but it's not: unfollow_after=486060. I have moved the unfollow script to run before the follow script in hopes that this will prevent it.

change follow = 40%
like a=only 60 images per hour.
change your IP addess

Welcome @dbmathis,
You can also use boundary parameter for choosing amount of users to take from each post for set_dont_unfollow_active_users
Right, settings starting with set_ are generally applying to all features. S o set_do_follow is to be used for every feature once you set. But in particular, follow_by_tags feature does not use it, instead it just visits tags and grabs links from there in the given amount; E.g., in your script above, it is used by like_by_tags.
When you mix bunch of features and then start unfollow procedure, you must self guess how many users it would follow so that you can unfollow that amount in return. _Personally I start unfollow with small amounts after each feature rather than couple of features.._
My script is out-dated and a bit complicated since I just run tests only these days or I would share, I do landscape photography most of time xD
I did write unfollow_after parameter myself and I can give you a guarranty that it will operate properly, just make sure you are using onlyInstapyFollowed = True as an unfollow method, some time I think to add support for the other method, but yet it is not supported. Also check your username_followedPool.csv file to see if it really records datetime stamps alongside followed usernames in your logs folder and see README for more details.
:)

Try to see how many actions you do in a day, maybe there is some loop that is just looping for too long, use lower values, for example you try like your feed for 200 images but get less so you will most probably loss lots of time trying to scrap the feed getting not-much results.

@uluQulu Thanks Again for this valuable information. I can use it to adjust the script to better guess the follow to unfollow ratio.

I had onlyInstapyFollowed set False. I thought that was set true, but I was looking at a backup of the file. I set it to True and I see the following now:

INFO [2018-05-05 09:48:23] [xx] Number of users available to unfollow: 0
INFO [2018-05-05 09:48:24] [xx] --> Total people unfollowed : 0

I'm assuming this is happening because I just started running the script 2 days ago and these's a delay in unfollowing based on that CSV log you mention? Just a guess. It has the timestamps you questioned about, here are the first three lines written:

2018-05-03 22:19 ~ livebythestars
2018-05-03 22:42 ~ liveonthewildside
2018-05-03 22:55 ~ southern.girl.with.a.camera

My pleasure @dbmathis,
Yes, exactly, as you use the program, it will record every followed user to that CSV file with a timestamp...
The reason it returned you 0 users to unfollow is you have set unfollow_after parameter for two days (48*60*60) and program cannot find any user followed before 2 days..
For now, I would recommend for you to either turn off unfollow_after parameter (_give unfollow_after=None or just remove it from function call_) or use other unfollow method, like onlyNotFollowMe and once you generate a good userbase in the CSV file after a few days, go back and use that parameter..

just follow 1000 a day until 7000 than unfollow 1000 a day until 0

I鈥檝e been gaining about 7 followers per day on average. We can close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rahulkapoor90 picture rahulkapoor90  路  3Comments

tibor picture tibor  路  3Comments

ingorichter picture ingorichter  路  3Comments

deronsizemore picture deronsizemore  路  3Comments

ghost picture ghost  路  3Comments