Created
October 10, 2023 08:45
-
-
Save habibiefaried/418714b9ca0ac2f69fcbc6096177f5cd to your computer and use it in GitHub Desktop.
buy the API from https://hikerapi.com/plan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from hikerapi import Client | |
cl = Client(token="xxxx") | |
user_id = "xxx" # <your IG ID> | |
def get_followers(cl, user_id): | |
followers = {} | |
followers_len = -1 | |
end_cursor = None | |
while len(followers) > followers_len: | |
followers_len = len(followers) | |
res, end_cursor = cl.user_followers_chunk_gql(user_id=user_id, end_cursor=end_cursor) | |
followers.update({item['pk']:item for item in res}) | |
return list(followers.values()) | |
def get_following(cl, user_id): | |
following = {} | |
following_len = -1 | |
end_cursor = None | |
while len(following) > following_len: | |
following_len = len(following) | |
res, end_cursor = cl.user_following_chunk_gql(user_id=user_id, end_cursor=end_cursor) | |
following.update({item['pk']:item for item in res}) | |
return list(following.values()) | |
followers_list = get_followers(cl, user_id) | |
following_list = get_following(cl, user_id) | |
print("[DEBUG] you have {} followers and {} following".format(len(followers_list), len(following_list))) | |
following = [] | |
for f in following_list: | |
following.append(f['username']) | |
followers = [] | |
for f2 in followers_list: | |
followers.append(f2['username']) | |
print("========================================================") | |
print("You follow this user but they are not following you") | |
print("========================================================") | |
print("") | |
for f in following: | |
if f not in followers: | |
print(f) | |
print("========================================================") | |
print("They are following you but you are not following them") | |
print("========================================================") | |
print("") | |
for f2 in followers: | |
if (f2 not in following): | |
print(f2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment