Last active
September 7, 2021 19:19
-
-
Save MrShameer/bca78faeda593c3f9180c0e6775199b0 to your computer and use it in GitHub Desktop.
A simple code to get two or more Instagram user's common followers or following
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
import instaloader | |
from instaloader import Profile | |
#to get followings of that username | |
def getfollowing(ids,lists): | |
profile = Profile.from_username(L.context, ids) | |
for followee in profile.get_followees(): #change to 'get_followers()' to get the persons followers | |
lists.append(followee) | |
def data(names): | |
datas = [[] for _ in range(len(names))] | |
string =[] | |
for index, name in enumerate(names): | |
getfollowing(name,datas[index]) | |
string.append('datas['+str(index)+']') | |
operation = ')&set('.join(string) | |
operation = 'print(set('+operation+'))' | |
exec(operation) | |
L = instaloader.Instaloader() | |
L.login(user="YOUR_USERNAME",passwd="YOUR_PASSWORD") | |
names = ["FIRST_ID","SECOND_ID","OPTIONAL_ID"] #put more that one username in this list. You can add more if you want a refined search | |
data(names) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment