Skip to content

Commit

Permalink
[bluesky] add 'feed' extractor (#4438)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Feb 8, 2024
1 parent 6aea818 commit 004bf7b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions gallery_dl/extractor/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ def posts(self):
return self.api.get_actor_likes(self.user)


class BlueskyFeedExtractor(BlueskyExtractor):
subcategory = "feed"
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/feed/([^/?#]+)"
example = "https://bsky.app/profile/HANDLE/feed/NAME"

def __init__(self, match):
BlueskyExtractor.__init__(self, match)
self.feed = match.group(2)

def posts(self):
return self.api.get_feed(self.user, self.feed)


class BlueskyPostExtractor(BlueskyExtractor):
subcategory = "post"
pattern = BASE_PATTERN + r"/profile/([^/?#]+)/post/([^/?#]+)"
Expand Down Expand Up @@ -170,6 +183,15 @@ def get_author_feed(self, actor, filter="posts_and_author_threads"):
}
return self._pagination(endpoint, params)

def get_feed(self, actor, feed):
endpoint = "app.bsky.feed.getFeed"
params = {
"feed" : "at://{}/app.bsky.feed.generator/{}".format(
self._did_from_actor(actor), feed),
"limit": "100",
}
return self._pagination(endpoint, params)

def get_post_thread(self, actor, post_id):
endpoint = "app.bsky.feed.getPostThread"
params = {
Expand Down

0 comments on commit 004bf7b

Please sign in to comment.