Skip to content

Commit

Permalink
[bluesky] add 'info' extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 5, 2024
1 parent a526a3d commit 624dc7f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Bluesky</td>
<td>https://bsky.app/</td>
<td>Avatars, Backgrounds, Feeds, Followed Users, Hashtags, Likes, Lists, Media Files, Posts, Replies, Search Results, User Profiles</td>
<td>Avatars, Backgrounds, Feeds, Followed Users, Hashtags, User Profile Information, Likes, Lists, Media Files, Posts, Replies, Search Results, User Profiles</td>
<td>Supported</td>
</tr>
<tr>
Expand Down
12 changes: 12 additions & 0 deletions gallery_dl/extractor/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def initialize(self):
def items(self):
base = "{}/profile/{}/".format(self.root, self.user)
return self._dispatch_extractors((
(BlueskyInfoExtractor , base + "info"),
(BlueskyAvatarExtractor , base + "avatar"),
(BlueskyBackgroundExtractor, base + "banner"),
(BlueskyPostsExtractor , base + "posts"),
Expand Down Expand Up @@ -301,6 +302,17 @@ def posts(self):
return self.api.get_post_thread(self.user, self.post_id)


class BlueskyInfoExtractor(BlueskyExtractor):
subcategory = "info"
pattern = USER_PATTERN + r"/info"
example = "https://bsky.app/profile/HANDLE/info"

def items(self):
self._metadata_user = True
self.api._did_from_actor(self.user)
return iter(((Message.Directory, self._user),))


class BlueskyAvatarExtractor(BlueskyExtractor):
subcategory = "avatar"
filename_fmt = "avatar_{post_id}.{extension}"
Expand Down
5 changes: 5 additions & 0 deletions test/results/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
),
},

{
"#url" : "https://bsky.app/profile/bsky.app/info",
"#class" : bluesky.BlueskyInfoExtractor,
},

{
"#url" : "https://bsky.app/profile/bsky.app/avatar",
"#category": ("", "bluesky", "avatar"),
Expand Down

0 comments on commit 624dc7f

Please sign in to comment.