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:
parent
88ba85d285
commit
f47c0982a0
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user