From a94672bedecac1b06e45be43cc55300f03a1b1cd Mon Sep 17 00:00:00 2001 From: "Soblow \"Opale\" Xaselgio" <113846014+Soblow@users.noreply.github.com> Date: Fri, 9 May 2025 11:49:10 +0200 Subject: [PATCH 1/3] [mastodon] Add support for Akkoma/Pleroma /notice/:status_id urls Signed-off-by: Soblow "Opale" Xaselgio <113846014+Soblow@users.noreply.github.com> --- gallery_dl/extractor/mastodon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/mastodon.py b/gallery_dl/extractor/mastodon.py index 5e78ad4d..4cb45c88 100644 --- a/gallery_dl/extractor/mastodon.py +++ b/gallery_dl/extractor/mastodon.py @@ -196,8 +196,8 @@ class MastodonFollowingExtractor(MastodonExtractor): class MastodonStatusExtractor(MastodonExtractor): """Extractor for images from a status""" subcategory = "status" - pattern = (BASE_PATTERN + r"/(?:@[^/?#]+|(?:users/[^/?#]+/)?statuses)" - r"/(?!following)([^/?#]+)") + pattern = (BASE_PATTERN + r"/(?:@[^/?#]+|(?:users/[^/?#]+/)?" + r"(?:statuses|notice))/(?!following)([^/?#]+)") example = "https://mastodon.social/@USER/12345" def statuses(self): From eba44b8f78b612aaf476ea01d3985331f4b7cb21 Mon Sep 17 00:00:00 2001 From: "Soblow \"Opale\" Xaselgio" <113846014+Soblow@users.noreply.github.com> Date: Fri, 9 May 2025 11:50:06 +0200 Subject: [PATCH 2/3] [mastodon] Add unit tests for various statuses URL formats on various fediverse software (mastodon/akkoma/pleroma) Signed-off-by: Soblow "Opale" Xaselgio <113846014+Soblow@users.noreply.github.com> --- test/results/mastodon.py | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/results/mastodon.py b/test/results/mastodon.py index b6cb3464..8c4b340a 100644 --- a/test/results/mastodon.py +++ b/test/results/mastodon.py @@ -8,6 +8,7 @@ from gallery_dl.extractor import mastodon __tests__ = ( +# Akkoma - /:user/:status_id { "#url" : "mastodon:https://donotsta.re/@elly/AcoUaA7EH1igiYKmFU", "#category": ("mastodon", "donotsta.re", "status"), @@ -29,4 +30,52 @@ __tests__ = ( "instance_remote": None, }, +# Akkoma - /notice/:status_id +{ + "#url" : "mastodon:https://woem.space/notice/Aswds12sVGsm55NS2S", + "#category": ("mastodon", "woem.space", "status"), + "#class" : mastodon.MastodonStatusExtractor, + "#urls" : "https://nbg1.your-objectstorage.com/woem-space/261f4f482e1cb641db732dab91f0177b1f5ea0bcf008f4831c593ff718dff4fe.jpg", + + "instance" : "woem.space", + "instance_remote": None, +}, + +# Note that Akkoma/Pleroma urls of type /objects/:UUID won't work, +# but attempting to access them will trigger a redirect. +# We could follow them + +# Akkoma - /notice/:status_id +{ + "#url" : "mastodon:https://labyrinth.zone/notice/Ai9Y2EijwN3gAil1nM", + "#category": ("mastodon", "labyrinth.zone", "status"), + "#class" : mastodon.MastodonStatusExtractor, + "#urls" : "https://media.labyrinth.zone/media/96e10a9e3b0f24f63713d8a03e939eec7f9e636cdef57a14c389163f58e60947.png", + + "instance" : "labyrinth.zone", + "instance_remote": None, +}, + +# Pleroma - /notice/:status_id +{ + "#url" : "mastodon:https://udongein.xyz/notice/Asl9hUpShUamlVAZiC", + "#category": ("mastodon", "udongein.xyz", "status"), + "#class" : mastodon.MastodonStatusExtractor, + "#urls" : "https://statics.udongein.xyz/udongein/cc3c7a8b749cd88298fda6553e10f81f9c4de280f03ad107ed25a439e6be23eb.jpg?name=Husky_1743801357069_6QIL5OZLXK.jpg", + + "instance" : "udongein.xyz", + "instance_remote": None, +}, + +# Mastodon - /:user/:status_id +{ + "#url" : "mastodon:https://freeradical.zone/@bitartbot/114477182939377350", + "#category": ("mastodon", "freeradical.zone", "status"), + "#class" : mastodon.MastodonStatusExtractor, + "#urls" : "https://nfts.freeradical.zone/media_attachments/files/114/477/182/897/690/030/original/96700c8ae9a79651.png", + + "instance" : "freeradical.zone", + "instance_remote": None, +} + ) From 1f7c29aee97065d8819d8a7f14a8f04266ae3439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 10 May 2025 17:48:50 +0200 Subject: [PATCH 3/3] [tests:mastodon] move comments into '#comments' fields --- test/results/mastodon.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/results/mastodon.py b/test/results/mastodon.py index 8c4b340a..14fa724a 100644 --- a/test/results/mastodon.py +++ b/test/results/mastodon.py @@ -8,9 +8,9 @@ from gallery_dl.extractor import mastodon __tests__ = ( -# Akkoma - /:user/:status_id { "#url" : "mastodon:https://donotsta.re/@elly/AcoUaA7EH1igiYKmFU", + "#comment" : "Akkoma - /:user/:status_id", "#category": ("mastodon", "donotsta.re", "status"), "#class" : mastodon.MastodonStatusExtractor, "#urls" : "https://asdf.donotsta.re/media/917e7722dd30d510686ce9f3717a1f722dac96fd974b5af5ec2ccbc8cbd740c6.png", @@ -30,9 +30,9 @@ __tests__ = ( "instance_remote": None, }, -# Akkoma - /notice/:status_id { "#url" : "mastodon:https://woem.space/notice/Aswds12sVGsm55NS2S", + "#comment" : "Akkoma - /notice/:status_id", "#category": ("mastodon", "woem.space", "status"), "#class" : mastodon.MastodonStatusExtractor, "#urls" : "https://nbg1.your-objectstorage.com/woem-space/261f4f482e1cb641db732dab91f0177b1f5ea0bcf008f4831c593ff718dff4fe.jpg", @@ -41,13 +41,9 @@ __tests__ = ( "instance_remote": None, }, -# Note that Akkoma/Pleroma urls of type /objects/:UUID won't work, -# but attempting to access them will trigger a redirect. -# We could follow them - -# Akkoma - /notice/:status_id { "#url" : "mastodon:https://labyrinth.zone/notice/Ai9Y2EijwN3gAil1nM", + "#comment" : "Akkoma - /notice/:status_id", "#category": ("mastodon", "labyrinth.zone", "status"), "#class" : mastodon.MastodonStatusExtractor, "#urls" : "https://media.labyrinth.zone/media/96e10a9e3b0f24f63713d8a03e939eec7f9e636cdef57a14c389163f58e60947.png", @@ -56,9 +52,9 @@ __tests__ = ( "instance_remote": None, }, -# Pleroma - /notice/:status_id { "#url" : "mastodon:https://udongein.xyz/notice/Asl9hUpShUamlVAZiC", + "#comment" : "Pleroma - /notice/:status_id", "#category": ("mastodon", "udongein.xyz", "status"), "#class" : mastodon.MastodonStatusExtractor, "#urls" : "https://statics.udongein.xyz/udongein/cc3c7a8b749cd88298fda6553e10f81f9c4de280f03ad107ed25a439e6be23eb.jpg?name=Husky_1743801357069_6QIL5OZLXK.jpg", @@ -67,15 +63,15 @@ __tests__ = ( "instance_remote": None, }, -# Mastodon - /:user/:status_id { "#url" : "mastodon:https://freeradical.zone/@bitartbot/114477182939377350", + "#comment" : "Mastodon - /:user/:status_id", "#category": ("mastodon", "freeradical.zone", "status"), "#class" : mastodon.MastodonStatusExtractor, "#urls" : "https://nfts.freeradical.zone/media_attachments/files/114/477/182/897/690/030/original/96700c8ae9a79651.png", "instance" : "freeradical.zone", "instance_remote": None, -} +}, )