Skip to content

Commit

Permalink
[bluesky] default to /posts if reposts/quoted is enabled (#6583)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 13, 2024
1 parent 85a37ca commit 94d7df1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,10 @@ Type
* ``string``
* ``list`` of ``strings``
Default
``"media"``
* ``"posts"`` if
`reposts <extractor.bluesky.reposts_>`__ or
`quoted <extractor.bluesky.quoted_>`__ is enabled
* ``"media"`` otherwise
Example
* ``"avatar,background,posts"``
* ``["avatar", "background", "posts"]``
Expand All @@ -1464,6 +1467,7 @@ Description
when processing a user profile.

Possible values are
``"info"``,
``"avatar"``,
``"background"``,
``"posts"``,
Expand Down
4 changes: 3 additions & 1 deletion gallery_dl/extractor/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ def initialize(self):

def items(self):
base = "{}/profile/{}/".format(self.root, self.user)
default = ("posts" if self.config("quoted", False) or
self.config("reposts", False) else "media")
return self._dispatch_extractors((
(BlueskyInfoExtractor , base + "info"),
(BlueskyAvatarExtractor , base + "avatar"),
Expand All @@ -212,7 +214,7 @@ def items(self):
(BlueskyRepliesExtractor , base + "replies"),
(BlueskyMediaExtractor , base + "media"),
(BlueskyLikesExtractor , base + "likes"),
), ("media",))
), (default,))


class BlueskyPostsExtractor(BlueskyExtractor):
Expand Down
10 changes: 9 additions & 1 deletion test/results/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"#class" : bluesky.BlueskyUserExtractor,
"#options" : {"include": "all"},
"#urls" : (
"https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/info",
"https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/avatar",
"https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/banner",
"https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/posts",
Expand All @@ -42,6 +43,13 @@
),
},

{
"#url" : "https://bsky.app/profile/bsky.app",
"#class" : bluesky.BlueskyUserExtractor,
"#options" : {"quoted": True},
"#urls" : "https://bsky.app/profile/bsky.app/posts",
},

{
"#url" : "https://bsky.app/profile/bsky.app/info",
"#class" : bluesky.BlueskyInfoExtractor,
Expand Down Expand Up @@ -357,7 +365,7 @@
"author": {
"createdAt": "2024-10-17T13:55:48.833Z",
"did" : "did:plc:7x6rtuenkuvxq3zsvffp2ide",
"handle" : "alt.bun.how",
"handle" : "cinny.bun.how",
"instance" : "bun.how",
},
},
Expand Down

0 comments on commit 94d7df1

Please sign in to comment.