Skip to content

Commit

Permalink
[bluesky] improve 'web' did handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 20, 2024
1 parent 88ba85d commit f47c098
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gallery_dl/extractor/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def items(self):
did = post["author"]["did"]
base = (
"{}/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):
post.update(file)
yield Message.Url, base + file["filename"], post
Expand Down Expand Up @@ -432,10 +432,9 @@ def resolve_handle(self, handle):
return self._call(endpoint, params)["did"]

@memcache(keyarg=1)
def get_service_endpoint(self, did):
def service_endpoint(self, did):
if did.startswith('did:web:'):
url = "https://{}/.well-known/did.json".format(
did.rpartition(":")[2])
url = "https://" + did[8:] + "/.well-known/did.json"
else:
url = "https://plc.directory/" + did

Expand Down

0 comments on commit f47c098

Please sign in to comment.