[bluesky] add 'depth' option (#4438)
and reduce default depth and parentHeight values
This commit is contained in:
@@ -1185,6 +1185,18 @@ Description
|
|||||||
Download embedded videos hosted on https://www.blogger.com/
|
Download embedded videos hosted on https://www.blogger.com/
|
||||||
|
|
||||||
|
|
||||||
|
extractor.bluesky.post.depth
|
||||||
|
----------------------------
|
||||||
|
Type
|
||||||
|
``integer``
|
||||||
|
Default
|
||||||
|
``0``
|
||||||
|
Description
|
||||||
|
Sets the maximum depth of returned reply posts.
|
||||||
|
|
||||||
|
(See `depth` parameter of `app.bsky.feed.getPostThread <https://www.docs.bsky.app/docs/api/app-bsky-feed-get-post-thread>`__)
|
||||||
|
|
||||||
|
|
||||||
extractor.cyberdrop.domain
|
extractor.cyberdrop.domain
|
||||||
--------------------------
|
--------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -206,9 +206,9 @@ class BlueskyAPI():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, extractor):
|
def __init__(self, extractor):
|
||||||
self.headers = {}
|
|
||||||
self.extractor = extractor
|
self.extractor = extractor
|
||||||
self.log = extractor.log
|
self.log = extractor.log
|
||||||
|
self.headers = {"Accept": "application/json"}
|
||||||
|
|
||||||
self.username, self.password = extractor._get_auth_info()
|
self.username, self.password = extractor._get_auth_info()
|
||||||
if self.username:
|
if self.username:
|
||||||
@@ -265,8 +265,22 @@ class BlueskyAPI():
|
|||||||
params = {
|
params = {
|
||||||
"uri": "at://{}/app.bsky.feed.post/{}".format(
|
"uri": "at://{}/app.bsky.feed.post/{}".format(
|
||||||
self._did_from_actor(actor), post_id),
|
self._did_from_actor(actor), post_id),
|
||||||
|
"depth" : self.extractor.config("depth", "0"),
|
||||||
|
"parentHeight": "0",
|
||||||
}
|
}
|
||||||
return (self._call(endpoint, params)["thread"],)
|
|
||||||
|
thread = self._call(endpoint, params)["thread"]
|
||||||
|
if "replies" not in thread:
|
||||||
|
return (thread,)
|
||||||
|
|
||||||
|
index = 0
|
||||||
|
posts = [thread]
|
||||||
|
while index < len(posts):
|
||||||
|
post = posts[index]
|
||||||
|
if "replies" in post:
|
||||||
|
posts.extend(post["replies"])
|
||||||
|
index += 1
|
||||||
|
return posts
|
||||||
|
|
||||||
def get_profile(self, actor):
|
def get_profile(self, actor):
|
||||||
endpoint = "app.bsky.actor.getProfile"
|
endpoint = "app.bsky.actor.getProfile"
|
||||||
|
|||||||
Reference in New Issue
Block a user