[mastodon] support '/@USER/following' URLs

Previously, only '/users/USER/following' got matched.
This commit is contained in:
Mike Fährmann
2023-09-13 23:42:51 +02:00
parent 9f75713e00
commit 24a1d46391
2 changed files with 8 additions and 2 deletions

View File

@@ -131,8 +131,8 @@ class MastodonBookmarkExtractor(MastodonExtractor):
class MastodonFollowingExtractor(MastodonExtractor):
"""Extractor for followed mastodon users"""
subcategory = "following"
pattern = BASE_PATTERN + r"/users/([^/?#]+)/following"
example = "https://mastodon.social/users/USER/following"
pattern = BASE_PATTERN + r"/(?:@|users/)([^/?#]+)/following"
example = "https://mastodon.social/@USER/following"
def items(self):
api = MastodonAPI(self)

View File

@@ -70,6 +70,12 @@ __tests__ = (
"#extractor": False,
},
{
"#url" : "https://mastodon.social/@0x4f/following",
"#category": ("mastodon", "mastodon.social", "following"),
"#class" : mastodon.MastodonFollowingExtractor,
},
{
"#url" : "https://mastodon.social/users/id:10843/following",
"#category": ("mastodon", "mastodon.social", "following"),