mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[bluesky] add 'depth' option (#4438)
and reduce default depth and parentHeight values
This commit is contained in:
parent
42335ea880
commit
7e036ea290
@ -1185,6 +1185,18 @@ Description
|
||||
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
|
||||
--------------------------
|
||||
Type
|
||||
|
@ -206,9 +206,9 @@ class BlueskyAPI():
|
||||
"""
|
||||
|
||||
def __init__(self, extractor):
|
||||
self.headers = {}
|
||||
self.extractor = extractor
|
||||
self.log = extractor.log
|
||||
self.headers = {"Accept": "application/json"}
|
||||
|
||||
self.username, self.password = extractor._get_auth_info()
|
||||
if self.username:
|
||||
@ -265,8 +265,22 @@ class BlueskyAPI():
|
||||
params = {
|
||||
"uri": "at://{}/app.bsky.feed.post/{}".format(
|
||||
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):
|
||||
endpoint = "app.bsky.actor.getProfile"
|
||||
|
Loading…
Reference in New Issue
Block a user