diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 07f5f55e..47dc5e6f 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1242,19 +1242,19 @@ Consider all sites to be NSFW unless otherwise known. mastodon.social https://mastodon.social/ - Images from Statuses, User Profiles + Bookmarks, Images from Statuses, User Profiles OAuth Pawoo https://pawoo.net/ - Images from Statuses, User Profiles + Bookmarks, Images from Statuses, User Profiles OAuth baraag https://baraag.net/ - Images from Statuses, User Profiles + Bookmarks, Images from Statuses, User Profiles OAuth diff --git a/gallery_dl/extractor/mastodon.py b/gallery_dl/extractor/mastodon.py index 9ce57723..296fd5f4 100644 --- a/gallery_dl/extractor/mastodon.py +++ b/gallery_dl/extractor/mastodon.py @@ -126,6 +126,20 @@ class MastodonUserExtractor(MastodonExtractor): ) +class MastodonBookmarkExtractor(MastodonExtractor): + """Extractor for mastodon bookmarks""" + subcategory = "bookmark" + pattern = BASE_PATTERN + r"/bookmarks" + test = ( + ("https://mastodon.social/bookmarks"), + ("https://pawoo.net/bookmarks"), + ("https://baraag.net/bookmarks"), + ) + + def statuses(self): + return MastodonAPI(self).account_bookmarks() + + class MastodonFollowingExtractor(MastodonExtractor): """Extractor for followed mastodon users""" subcategory = "following" @@ -204,6 +218,10 @@ class MastodonAPI(): return account["id"] raise exception.NotFoundError("account") + def account_bookmarks(self): + endpoint = "/v1/bookmarks" + return self._pagination(endpoint, None) + def account_following(self, account_id): endpoint = "/v1/accounts/{}/following".format(account_id) return self._pagination(endpoint, None)