From 2ae4150ba1323515e0ccf0efd925d91dc3d86816 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 24 Oct 2020 10:58:27 +0100 Subject: [PATCH] Check for followers with non-standard paths --- follow.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/follow.py b/follow.py index d34b7b65..dc917cd2 100644 --- a/follow.py +++ b/follow.py @@ -155,7 +155,26 @@ def isFollowerOfPerson(baseDir: str, nickname: str, domain: str, if not os.path.isfile(followersFile): return False handle = followerNickname + '@' + followerDomain - return handle in open(followersFile).read() + + alreadyFollowing = False + + followersStr = '' + with open(followersFile, 'r') as fpFollowers: + followersStr = fpFollowers.read() + + if handle in followersStr: + alreadyFollowing = True + elif '://' + followerDomain + \ + '/profile/' + followerNickname in followersStr: + alreadyFollowing = True + elif '://' + followerDomain + \ + '/channel/' + followerNickname in followersStr: + alreadyFollowing = True + elif '://' + followerDomain + \ + '/accounts/' + followerNickname in followersStr: + alreadyFollowing = True + + return alreadyFollowing: def unfollowPerson(baseDir: str, nickname: str, domain: str,