Function for finding mutuals

main
Bob Mottram 2020-01-13 16:06:31 +00:00
parent 97f94e7726
commit cdc2b67bc7
1 changed files with 16 additions and 0 deletions

View File

@ -107,6 +107,22 @@ def isFollowingActor(baseDir: str,nickname: str,domain: str,actor: str) -> bool:
return True
return False
def getMutualsOfPerson(baseDir: str, \
nickname: str,domain: str, \
followFile='following.txt') -> []:
"""Returns the mutuals of a person
i.e. accounts which they follow and which also follow back
"""
followers= \
getFollowersOfPerson(baseDir,nickname,domain,'followers')
following= \
getFollowersOfPerson(baseDir,nickname,domain,'following')
mutuals=[]
for handle in following:
if handle in followers:
mutuals.append(handle)
return mutuals
def getFollowersOfPerson(baseDir: str, \
nickname: str,domain: str, \
followFile='following.txt') -> []: