From cdc2b67bc74e7ca44ca813f369c6080667087afb Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 13 Jan 2020 16:06:31 +0000 Subject: [PATCH] Function for finding mutuals --- follow.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/follow.py b/follow.py index 68cfcd92..8b90a61f 100644 --- a/follow.py +++ b/follow.py @@ -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') -> []: