diff --git a/bluesky/input.py b/bluesky/input.py index 6daa42c..1506646 100644 --- a/bluesky/input.py +++ b/bluesky/input.py @@ -121,7 +121,12 @@ class BlueskyBaseInputService(BlueskyService, InputService, ABC): if embed.get("media"): return handle_embeds(embed["media"]) case "app.bsky.embed.images": - for item in embed["images"]: + for image in embed["images"]: + blob_cid = image["image"]["ref"]["$link"] + url = f"{self.pds}/xrpc/com.atproto.sync.getBlob?did={self.did}&cid={blob_cid}" + blob_urls.append((url, blob_cid, image.get("alt"))) + case "app.bsky.embed.gallery": + for item in embed["items"]: match cast(str, item["$type"]): case "app.bsky.embed.gallery#image": blob_cid = item["image"]["ref"]["$link"] @@ -131,11 +136,6 @@ class BlueskyBaseInputService(BlueskyService, InputService, ABC): self.log.warning( f"unhandled gallery item type '{item['$type']}'" ) - case "app.bsky.embed.gallery": - for image in embed["items"]: - blob_cid = image["image"]["ref"]["$link"] - url = f"{self.pds}/xrpc/com.atproto.sync.getBlob?did={self.did}&cid={blob_cid}" - blob_urls.append((url, blob_cid, image.get("alt"))) case "app.bsky.embed.video": blob_cid = embed["video"]["ref"]["$link"] url = f"{self.pds}/xrpc/com.atproto.sync.getBlob?did={self.did}&cid={blob_cid}"