Relationship Tools

Grab Followers of a user

Gets and returns followers of the given user in desired amount, also can save locally
popeye_followers = session.grab_followers(username="Popeye", amount="full", live_match=True, store_locally=True)
##now, `popeye_followers` variable which is a list- holds the `Followers` data of "Popeye" at requested time

Parameters:

username: A desired username to grab its followers

  • It can be your own username OR a username of some non-private account.

amount: Defines the desired amount of usernames to grab from the given account

  • amount="full":
    • Grabs followers entirely
  • amount=3089:
    • Grabs 3089 usernames if exist, if not, grabs available amount

live_match: Defines the method of grabbing Followers data

Knowledge Base: Every time you grab Followers data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Followers data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Followers data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Followers data in a local storage The files will be saved into your logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/Popeye/followers/ directory. Sample filename 14-06-2018~full~6874.json:

  • 14-06-2018 means the time of the data acquisition.
  • "full" means the range of the data acquisition; If the data is requested at the range else than "full", it will write that range.
  • 6874 means the count of the usernames retrieved.
  • json is the filetype and the data is stored as a list in it.

There are several use cases of this tool for various purposes. E.g., inside your quickstart script, you can do something like this:

#get followers of "Popeye" and "Cinderella"
popeye_followers = session.grab_followers(username="Popeye", amount="full", live_match=True, store_locally=True)
sleep(600)
cinderella_followers = session.grab_followers(username="Cinderella", amount="full", live_match=True, store_locally=True)
#find the users following "Popeye" WHO also follow "Cinderella" :D
popeye_cinderella_followers = [follower for follower in popeye_followers if follower in cinderella_followers]

PROs

You can use this tool to take a backup of your or any other user's current followers.

Grab Following of a user

Gets and returns following of the given user in desired amount, also can save locally
lazySmurf_following = session.grab_following(username="lazy.smurf", amount="full", live_match=True, store_locally=True)
##now, `lazySmurf_following` variable which is a list- holds the `Following` data of "lazy.smurf" at requested time

Parameters:

username: A desired username to grab its following

  • It can be your own username OR a username of some non-private account.

amount: Defines the desired amount of usernames to grab from the given account

  • amount="full":
    • Grabs following entirely
  • amount=3089:
    • Grabs 3089 usernames if exist, if not, grabs available amount

live_match: Defines the method of grabbing Following data

Knowledge Base: Every time you grab Following data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Following data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Following data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Following data in a local storage The files will be saved into your logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/lazy.smurf/following/ directory. Sample filename 15-06-2018~full~2409.json:

  • 15-06-2018 means the time of the data acquisition.
  • "full" means the range of the data acquisition; If the data is requested at the range else than "full", it will write that range.
  • 2409 means the count of the usernames retrieved.
  • json is the filetype and the data is stored as a list in it.

There are several use cases of this tool for various purposes. E.g., inside your quickstart script, you can do something like this:

##as we know that all lazy Smurf care is to take some good rest, so by mistake, he can follow somebody WHOM Gargamel also follow!
#so let's find it out to save Smurfs from troubles! :D
#get following of "lazy.smurf" and "Gargamel"
lazySmurf_following = session.grab_following(username="lazy.smurf", amount="full", live_match=True, store_locally=True)
sleep(600)
gargamel_following = session.grab_following(username="Gargamel", amount="full", live_match=True, store_locally=True)
#find the users "lazy.smurf" is following WHOM "Gargamel" also follow :D
lazySmurf_gargamel_following = [following for following in lazySmurf_following if following in gargamel_following]

PROs

You can use this tool to take a backup of your or any other user's current following.

Pick Unfollowers of a user

Compares the followers stored in a local storage against current followers and returns absent followers
all_unfollowers, active_unfollowers = session.pick_unfollowers(username="Bernard_bear", compare_by="month", compare_track="first", live_match=True, store_locally=True, print_out=True)
##now, `all_unfollowers` and `all_unfollowers` variables which are lists- hold the `Unfollowers` data of "Bernard_bear" at requested time
#`all_unfollowers` holds all of the unfollowers WHILST `active_unfollowers` holds the unfollowers WHOM "Bernard_bear" is still following

Parameters:

username: A desired username to pick its unfollowers

  • It can be your own username OR a username of some non-private account.

compare_by: Defines the compare point to pick unfollowers

  • Available values are:

    • "latest" chooses the very latest record from the existing records in the local folder

    • "earliest" chooses the very earliest record from the existing records in the local folder

      The compare points below needs a compare track defined, too:

    • "day" chooses from the existing records of today in the local folder

    • "month" chooses from the existing records of this month in the local folder

    • "year" chooses from the existing records of this year in the local folder

compare_track: Defines the track to choose a file to compare for "day", "month" and "year" compare points

  • Available values are:
    • "first" selects the first record from the given day, month or year
    • "median" selects the median (the one in the middle) record from the given day, month or year
    • "last" selects the last record from the given day, month or year

live_match: Defines the method of grabbing new Followers data to compare with existing data

Knowledge Base: Every time you grab Followers data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Followers data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Followers data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Unfollowers data in a local storage There will be 2 files saved in their own directory:

  • all_unfollowers:
    • Will store all of the unfollowers in there
    • Its files will be saved at logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/Bernard_bear/unfollowers/all_unfollowers/ directory.
  • active_unfollowers:
    • Will store only the unfollowers WHOM you are currently following.
    • Its files will be saved at logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/Bernard_bear/unfollowers/active_unfollowers/ directory.

Sample filename 03-06-2018~all~75.json:

  • 03-06-2018 means the time of the data acquisition.
  • "all" means that it is all of the unfollowers data; *"active" unfollowers files will have "active" written in there.
  • 75 means the count of the unfollowers retrieved.
  • json is the filetype and the data is stored as a list in it.

print_out: Use this parameter if you would like the see those unfollowers printed into the console output right after finding them.

There are several use cases of this tool for various purposes.

  • You can the get the unfollowers you have had from the start of the year, or from the middle of the year or from the start of the month, etc. And then, e.g. do some useful analysis with that generated unfollowers data.
  • And you can also find the unfollowers to block them all.
  • Also, you can unfollow back those active unfollowers right away:
#find all of the active unfollowers of Bernard bear
all_unfollowers, active_unfollowers = session.pick_unfollowers(username="Bernard_bear", compare_by="earliest", compare_track="first", live_match=True, store_locally=True, print_out=True)
sleep(200)
#let's unfollow them immediately cos Bernard will be angry if heards about those unfollowers! :D
session.unfollow_users(amount=len(active_unfollowers), customList=(True, active_unfollowers, "all"), style="RANDOM", unfollow_after=None, sleep_delay=600)

Pick Nonfollowers of a user

Compares the Followers data against Following data of a user and returns the Nonfollowers data
scoobyDoo_nonfollowers = session.pick_nonfollowers(username="ScoobyDoo", live_match=True, store_locally=True)
#now, `scoobyDoo_nonfollowers` variable which is a list- holds the `Nonfollowers` data of "ScoobyDoo" at requested time

Parameters:

username: A desired username to pick its nonfollowers

  • It can be your own username OR a username of some non-private account.

live_match: Defines the method of grabbing Followers and Following data to compare with each other to find nonfollowers

Knowledge Base: Every time you grab Followers and/or Following data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Followers and/or Following data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Followers and/or Following data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Nonfollowers data in a local storage The files will be saved into your logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/ScoobyDoo/nonfollowers/ directory. Sample filename 01-06-2018~[5886-3575]~2465.json:

  • 01-06-2018 means the time of the data acquisition.
  • 5886 means the count of the followers retrieved.
  • 3575 means the count of the following retrieved.
  • 2465 means the count of the nonfollowers picked.
  • json is the filetype and the data is stored as a list in it.

There are several use cases of this tool for various purposes.

  • You can get the nonfollowers of several users and then do analysis.

    • e.g., in this example Scooby Do used it like this:

      ##Scooby Doo always wonders a lot and this time he wonders if there are people Shaggy is following WHO do not follow him back...
      shaggy_nonfollowers = session.pick_nonfollowers(username="Shaggy", live_match=True, store_locally=True)
      #now Scooby Doo will tell his friend Shaggy about this, who knows, maybe Shaggy will unfollow them all or even add to block :D

Pick Fans of a user

Returns Fans data- all of the accounts who do follow the user WHOM user itself do not follow back
smurfette_fans = session.pick_fans(username="Smurfette", live_match=True, store_locally=True)
#now, `smurfette_fans` variable which is a list- holds the `Fans` data of "Smurfette" at requested time

Parameters:

username: A desired username to pick its fans

  • It can be your own username OR a username of some non-private account.

live_match: Defines the method of grabbing Followers and Following data to compare with each other to find fans

Knowledge Base: Every time you grab Followers and/or Following data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Followers and/or Following data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Followers and/or Following data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Fans data in a local storage The files will be saved into your logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/Smurfette/fans/ directory. Sample filename 05-06-2018~[4591-2575]~3477.json:

  • 05-06-2018 means the time of the data acquisition.
  • 4591 means the count of the followers retrieved.
  • 2575 means the count of the following retrieved.
  • 3477 means the count of the fans picked.
  • json is the filetype and the data is stored as a list in it.

There are several use cases of this tool for various purposes.

  • You can get the fans of several users and then do analysis.
    • e.g., in this example Smurfette used it like this:
      ##Smurfette is so famous in the place and she wonders which smurfs is following her WHOM she doesn't even know of :D
      smurfette_fans = session.pick_fans(username="Smurfette", live_match=True, store_locally=True)
      #and now, maybe she will follow back some of the smurfs whom she may know :P

Pick Mutual Following of a user

Returns Mutual Following data- all of the accounts who do follow the user WHOM user itself also do follow back
Winnie_mutualFollowing = session.pick_mutual_following(username="WinnieThePooh", live_match=True, store_locally=True)
#now, `Winnie_mutualFollowing` variable which is a list- holds the `Mutual Following` data of "WinnieThePooh" at requested time

Parameters:

username: A desired username to pick its mutual following

  • It can be your own username OR a username of some non-private account.

live_match: Defines the method of grabbing Followers and Following data to compare with each other to find mutual following

Knowledge Base: Every time you grab Followers and/or Following data in "full" range of any user, it is also gonna be stored in some corner of InstaPy for that session.

  • live_match=False:
    • If the user already do have a Followers and/or Following data loaded earlier in the same session, it will run a smart data-matching algorithm. And there, it will load only the new data from the server and then return a compact result of current data. The algorithm works like: load the usernames until hits the ones from the previous query at certain amount.
    • Also if the live_match is False and the user has no any sessional Followers and/or Following data, then it will load live data at requested range.
    • As a result, live_match=False saves lots of precious time and server requests.
  • live_match=True:
    • It will always load live data from the server at requested range.

store_locally: Gives the option to save the loaded Mutual Following data in a local storage The files will be saved into your logs folder, ~/InstaPy/logs/YourOwnUsername/relationship_data/WinnieThePooh/mutual_following/ directory. Sample filename 11-06-2018~[3872-2571]~1120.json:

  • 11-06-2018 means the time of the data acquisition.
  • 3872 means the count of the followers retrieved.
  • 2571 means the count of the following retrieved.
  • 1120 means the count of the mutual following picked.
  • json is the filetype and the data is stored as a list in it.

There are several use cases of this tool for various purposes.

  • You can get the mutual following of several users and then do analysis.
    • e.g., in this example Winnie The Pooh used it like this:
      #Winnie The Pooh is a very friendly guy and almost everybody follows him back, but he wants to be sure about it :D
      Winnie_mutual_following = session.pick_mutual_following(username="WinnieThePooh", live_match=True, store_locally=True)
      ##now, he will write a message to his mutual followers to help him get a new honey pot :>