[mastodon] improve account searches (fixes #704)

Searching for just the username ("@NAME") can produce multiple
unrelated results, so we now search for username + mastodon instance
("@NAME@INSTANCE")
This commit is contained in:
Mike Fährmann
2020-04-23 20:23:10 +02:00
parent 400a0df661
commit 12ff23b6cc

View File

@@ -68,8 +68,8 @@ class MastodonUserExtractor(MastodonExtractor):
self.account_name = match.group(1)
def statuses(self):
results = self.api.account_search("@" + self.account_name, 1)
for account in results:
handle = "@{}@{}".format(self.account_name, self.instance)
for account in self.api.account_search(handle, 1):
if account["username"] == self.account_name:
break
else: