Abhinav Rai

Knowledge of competitive coding helps!

I’ve done competitive coding for quite some time in college and today was another such instance when this helped me figure out an interesting recursive solution to a problem.

Problem: I am building an Instagram automator. So, User fills out hashtags, location and similar account to his as data. Like if I am food blogger — my hastags to search for posts would be #food, #foodgasm, #foodie, #foodporn, etc. My locations to add would be Chandni chowk or any particular places and instagram accounts similar to me would be lovefood, jodhpurfoodie, etc. Now I want to automate Likes and Comments on behalf of me to posts fulfilling the criteria and Follow some users. This is what it takes to increase engagement.

_Q.1 How to get these posts on whom to like and comment?

  1. By Hashtags
  2. By Places
  3. Posts of the users who have commented on the posts of accounts similar to mine
  4. Posts of users who have liked the posts of accounts similar to mine
  5. Posts of the users who have followed the accounts similar to mine_

_Q.2: How to get these users to send follow request?

  1. Users who have posted with the hashtag I am targeting
  2. Users who have posted at a particular place I am targeting
  3. Users who have commented on the posts of accounts similar to mine
  4. Users who have liked the posts of accounts similar to mine
  5. Users who have followed the accounts similar to mine_

I can get all this data but this data is huge! Followers of even one of similar accounts can be greater than 10000. And Instagram limits allow about 500–800 likes/follows/comments a day. Instagram automation is all about choosing the right set of people/posts to perform the specific actions on.

So I took this information from the user for whom I am doing this task.

Rating from 1 to 10 for each of the criteria Rating from 1 to 10 for each of the criteria

The person has to rate from 1 to 10 for each of these 5 criterias.

  1. Hashtags
  2. Location
  3. Commenters on posts of Similar Accounts
  4. Likers on posts of Similar Accounts
  5. Followers of Similar Accounts

Solution: Let’s call each of these ratings as r1, r2, r3, r4, r5 respectively. And let x1, x2, x3, x4, x5 be the number of specific action performed (like/comment/follow) for each of these criterias.

So x1+ x2 + x3+ x4 + x5 = specific actions to be performed in a day (say 500 likes) or s

Also as these ratings follow linear relationship, so x1/r1 = x2/r2 = x3/r3 = x4/r4 = x5/r5 So solving for x1, we get x1 = s * r1 / (r1+r2+r3+r4+r5) So we got the value of x1, x2, x3, x4, x5. Based on the criteria the user entered — we have selected those posts/users for per day.

Now another problem comes is that we assumed that the number of posts/users for each type (x1,x2,x3, …) are abundant. But what if we are in the shortage of those posts/users.

Say I have just 3 criterias — hashtags, likers on post and location. I give 7/10 to hashtags, 1/10 to likers on similar account and 2/10 to location. So to perform like action on 100 posts, using the above formula I would have 20 posts from location and 70 posts from hashtags and 10 posts from likers of similar account. I assumed that I would have≥ 70 posts for hashtags and ≥ 20 posts for locations and ≥ posts for likers of similar location. But I had only 50 posts for hashtags and 100, 100 posts for location and likers of similar account. So I would stop my process after 50 posts for hashtags and repeat the whole process again by removing the criteria as I have to get 100 to like.

So By the time I completed 50 posts of hashtags (x1=50), using x1/r1 = x2/r2 = x3/r2 ; we can get values of x2 and x3.

So location posts would be 14.3 ~ 14 (taking floor) and likers on similar account would be 7.1 ~7. So 50+14+7 would be 71 posts. Remaining posts to like = 100–71 = 29 So let’s apply the same algorithm without the hashtags criteria as it’s posts are finished.

x2+x3 = 29 and x2/r2 = x3/r3
r2 = 0.2, r3 = 0.1

x2 = 19 and x3 = 9 So x2 total would be 14+19 = 33 and x3 total would be 7+9 = 16 x1 = 50 Final = 50 + 33 + 16 = 99(As we took floor everywhere) ~~ 100

I am building a chrome extension with a bunch of instagram tools like getting common followers/followings between 4 instagram accounts, analyse specific user — their followers/followings/posts/likers of their posts/commenters on their posts, get posts by hastags/locations, like/comment/follow posts of a specific user and from feed or by name, Automation and much more! You can also download all this data in csv. Would add the link here as soon as I publish it to chrome store. It does not ask for user and password unlike other services available and this is free for first 10 days.

You may contact the author at abhinav.rai.1996@gmail.com