[mastodon] add 'bookmark' extractor (#3109)

pull/3119/head
Mike Fährmann 2 years ago
parent c8af1f585a
commit 58d97188b4
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1242,19 +1242,19 @@ Consider all sites to be NSFW unless otherwise known.
<tr>
<td>mastodon.social</td>
<td>https://mastodon.social/</td>
<td>Images from Statuses, User Profiles</td>
<td>Bookmarks, Images from Statuses, User Profiles</td>
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
</tr>
<tr>
<td>Pawoo</td>
<td>https://pawoo.net/</td>
<td>Images from Statuses, User Profiles</td>
<td>Bookmarks, Images from Statuses, User Profiles</td>
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
</tr>
<tr>
<td>baraag</td>
<td>https://baraag.net/</td>
<td>Images from Statuses, User Profiles</td>
<td>Bookmarks, Images from Statuses, User Profiles</td>
<td><a href="https://github.com/mikf/gallery-dl#oauth">OAuth</a></td>
</tr>

@ -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)

Loading…
Cancel
Save