[mastodon] support Akkoma/Pleroma '/objects/:uuid' URLs (#7497)

This commit is contained in:
Mike Fährmann
2025-05-10 18:00:25 +02:00
parent 18eac5ca70
commit cd01eacd3d
2 changed files with 16 additions and 1 deletions

View File

@@ -197,10 +197,14 @@ class MastodonStatusExtractor(MastodonExtractor):
"""Extractor for images from a status"""
subcategory = "status"
pattern = (BASE_PATTERN + r"/(?:@[^/?#]+|(?:users/[^/?#]+/)?"
r"(?:statuses|notice))/(?!following)([^/?#]+)")
r"(?:statuses|notice|objects()))/(?!following)([^/?#]+)")
example = "https://mastodon.social/@USER/12345"
def statuses(self):
if self.groups[-2] is not None:
url = "{}/objects/{}".format(self.root, self.item)
location = self.request_location(url)
self.item = location.rpartition("/")[2]
return (MastodonAPI(self).status(self.item),)

View File

@@ -74,4 +74,15 @@ __tests__ = (
"instance_remote": None,
},
{
"#url" : "mastodon:https://labyrinth.zone/objects/ac523779-93d3-4315-ab8e-25b1665740cf",
"#comment" : "/objects/:uuid (#7497)",
"#category": ("mastodon", "labyrinth.zone", "status"),
"#class" : mastodon.MastodonStatusExtractor,
"#urls" : "https://media.labyrinth.zone/media/96e10a9e3b0f24f63713d8a03e939eec7f9e636cdef57a14c389163f58e60947.png",
"instance" : "labyrinth.zone",
"instance_remote": None,
},
)