[bluesky] add 'list' extractor (#4438)
This commit is contained in:
@@ -135,6 +135,19 @@ class BlueskyFeedExtractor(BlueskyExtractor):
|
|||||||
return self.api.get_feed(self.user, self.feed)
|
return self.api.get_feed(self.user, self.feed)
|
||||||
|
|
||||||
|
|
||||||
|
class BlueskyListExtractor(BlueskyExtractor):
|
||||||
|
subcategory = "list"
|
||||||
|
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/lists/([^/?#]+)"
|
||||||
|
example = "https://bsky.app/profile/HANDLE/lists/ID"
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
BlueskyExtractor.__init__(self, match)
|
||||||
|
self.list = match.group(2)
|
||||||
|
|
||||||
|
def posts(self):
|
||||||
|
return self.api.get_list_feed(self.user, self.list)
|
||||||
|
|
||||||
|
|
||||||
class BlueskyPostExtractor(BlueskyExtractor):
|
class BlueskyPostExtractor(BlueskyExtractor):
|
||||||
subcategory = "post"
|
subcategory = "post"
|
||||||
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/post/([^/?#]+)"
|
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/post/([^/?#]+)"
|
||||||
@@ -192,6 +205,15 @@ class BlueskyAPI():
|
|||||||
}
|
}
|
||||||
return self._pagination(endpoint, params)
|
return self._pagination(endpoint, params)
|
||||||
|
|
||||||
|
def get_list_feed(self, actor, list):
|
||||||
|
endpoint = "app.bsky.feed.getListFeed"
|
||||||
|
params = {
|
||||||
|
"list" : "at://{}/app.bsky.graph.list/{}".format(
|
||||||
|
self._did_from_actor(actor), list),
|
||||||
|
"limit": "100",
|
||||||
|
}
|
||||||
|
return self._pagination(endpoint, params)
|
||||||
|
|
||||||
def get_post_thread(self, actor, post_id):
|
def get_post_thread(self, actor, post_id):
|
||||||
endpoint = "app.bsky.feed.getPostThread"
|
endpoint = "app.bsky.feed.getPostThread"
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
Reference in New Issue
Block a user