1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[bluesky] improve 'web' did handling

This commit is contained in:
Mike Fährmann 2024-11-20 16:05:05 +01:00
parent 88ba85d285
commit f47c0982a0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -64,7 +64,7 @@ class BlueskyExtractor(Extractor):
did = post["author"]["did"] did = post["author"]["did"]
base = ( base = (
"{}/xrpc/com.atproto.sync.getBlob?did={}&cid=".format( "{}/xrpc/com.atproto.sync.getBlob?did={}&cid=".format(
self.api.get_service_endpoint(did), did)) self.api.service_endpoint(did), did))
for post["num"], file in enumerate(files, 1): for post["num"], file in enumerate(files, 1):
post.update(file) post.update(file)
yield Message.Url, base + file["filename"], post yield Message.Url, base + file["filename"], post
@ -432,10 +432,9 @@ class BlueskyAPI():
return self._call(endpoint, params)["did"] return self._call(endpoint, params)["did"]
@memcache(keyarg=1) @memcache(keyarg=1)
def get_service_endpoint(self, did): def service_endpoint(self, did):
if did.startswith('did:web:'): if did.startswith('did:web:'):
url = "https://{}/.well-known/did.json".format( url = "https://" + did[8:] + "/.well-known/did.json"
did.rpartition(":")[2])
else: else:
url = "https://plc.directory/" + did url = "https://plc.directory/" + did