[mastodon] warn about moved accounts (#2939)
This commit is contained in:
@@ -31,6 +31,8 @@ class MastodonExtractor(BaseExtractor):
|
|||||||
def items(self):
|
def items(self):
|
||||||
for status in self.statuses():
|
for status in self.statuses():
|
||||||
|
|
||||||
|
if self._check_move:
|
||||||
|
self._check_move(status["account"])
|
||||||
if not self.reblogs and status["reblog"]:
|
if not self.reblogs and status["reblog"]:
|
||||||
self.log.debug("Skipping %s (reblog)", status["id"])
|
self.log.debug("Skipping %s (reblog)", status["id"])
|
||||||
continue
|
continue
|
||||||
@@ -56,6 +58,12 @@ class MastodonExtractor(BaseExtractor):
|
|||||||
"""Return an iterable containing all relevant Status objects"""
|
"""Return an iterable containing all relevant Status objects"""
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
def _check_move(self, account):
|
||||||
|
self._check_move = None
|
||||||
|
if "moved" in account:
|
||||||
|
self.log.warning("Account '%s' moved to '%s'",
|
||||||
|
account["acct"], account["moved"]["acct"])
|
||||||
|
|
||||||
|
|
||||||
INSTANCES = {
|
INSTANCES = {
|
||||||
"mastodon.social": {
|
"mastodon.social": {
|
||||||
@@ -192,6 +200,7 @@ class MastodonAPI():
|
|||||||
handle = "@{}@{}".format(username, self.extractor.instance)
|
handle = "@{}@{}".format(username, self.extractor.instance)
|
||||||
for account in self.account_search(handle, 1):
|
for account in self.account_search(handle, 1):
|
||||||
if account["username"] == username:
|
if account["username"] == username:
|
||||||
|
self.extractor._check_move(account)
|
||||||
return account["id"]
|
return account["id"]
|
||||||
raise exception.NotFoundError("account")
|
raise exception.NotFoundError("account")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user