diff --git a/follow.py b/follow.py index ea3ac55b..2dd88048 100644 --- a/follow.py +++ b/follow.py @@ -112,8 +112,7 @@ def isFollowingActor(baseDir: str, def getMutualsOfPerson(baseDir: str, - nickname: str, domain: str, - followFile='following.txt') -> []: + nickname: str, domain: str) -> []: """Returns the mutuals of a person i.e. accounts which they follow and which also follow back """ @@ -128,6 +127,22 @@ def getMutualsOfPerson(baseDir: str, return mutuals +def getNonMutualsOfPerson(baseDir: str, + nickname: str, domain: str) -> []: + """Returns the followers who are not mutuals of a person + i.e. accounts which follow you but you don't follow them + """ + followers = \ + getFollowersOfPerson(baseDir, nickname, domain, 'followers') + following = \ + getFollowersOfPerson(baseDir, nickname, domain, 'following') + nonMutuals = [] + for handle in following: + if handle not in followers: + nonMutuals.append(handle) + return nonMutuals + + def getFollowersOfPerson(baseDir: str, nickname: str, domain: str, followFile='following.txt') -> []: