[bluesky] default to /posts if reposts/quoted is enabled (#6583)
This commit is contained in:
@@ -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"]``
|
||||
@@ -1464,6 +1467,7 @@ Description
|
||||
when processing a user profile.
|
||||
|
||||
Possible values are
|
||||
``"info"``,
|
||||
``"avatar"``,
|
||||
``"background"``,
|
||||
``"posts"``,
|
||||
|
||||
@@ -204,6 +204,8 @@ class BlueskyUserExtractor(BlueskyExtractor):
|
||||
|
||||
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"),
|
||||
@@ -212,7 +214,7 @@ class BlueskyUserExtractor(BlueskyExtractor):
|
||||
(BlueskyRepliesExtractor , base + "replies"),
|
||||
(BlueskyMediaExtractor , base + "media"),
|
||||
(BlueskyLikesExtractor , base + "likes"),
|
||||
), ("media",))
|
||||
), (default,))
|
||||
|
||||
|
||||
class BlueskyPostsExtractor(BlueskyExtractor):
|
||||
|
||||
@@ -33,6 +33,7 @@ __tests__ = (
|
||||
"#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",
|
||||
@@ -42,6 +43,13 @@ __tests__ = (
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
"#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,
|
||||
@@ -357,7 +365,7 @@ __tests__ = (
|
||||
"author": {
|
||||
"createdAt": "2024-10-17T13:55:48.833Z",
|
||||
"did" : "did:plc:7x6rtuenkuvxq3zsvffp2ide",
|
||||
"handle" : "alt.bun.how",
|
||||
"handle" : "cinny.bun.how",
|
||||
"instance" : "bun.how",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user