[mastodon] support Akkoma/Pleroma '/objects/:uuid' URLs (#7497)
This commit is contained in:
@@ -197,10 +197,14 @@ class MastodonStatusExtractor(MastodonExtractor):
|
|||||||
"""Extractor for images from a status"""
|
"""Extractor for images from a status"""
|
||||||
subcategory = "status"
|
subcategory = "status"
|
||||||
pattern = (BASE_PATTERN + r"/(?:@[^/?#]+|(?:users/[^/?#]+/)?"
|
pattern = (BASE_PATTERN + r"/(?:@[^/?#]+|(?:users/[^/?#]+/)?"
|
||||||
r"(?:statuses|notice))/(?!following)([^/?#]+)")
|
r"(?:statuses|notice|objects()))/(?!following)([^/?#]+)")
|
||||||
example = "https://mastodon.social/@USER/12345"
|
example = "https://mastodon.social/@USER/12345"
|
||||||
|
|
||||||
def statuses(self):
|
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),)
|
return (MastodonAPI(self).status(self.item),)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -74,4 +74,15 @@ __tests__ = (
|
|||||||
"instance_remote": None,
|
"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,
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user