mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-26 04:32:51 +01:00
[mastodon] add 'bookmark' extractor (#3109)
This commit is contained in:
parent
c8af1f585a
commit
58d97188b4
@ -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…
Reference in New Issue
Block a user