Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: fixing unexpected key error (bluesky) (#2152)

Barbarella6666666f0b1ec33ec62
diff --git a/cyberdrop_dl/crawlers/bluesky/crawler.py b/cyberdrop_dl/crawlers/bluesky/crawler.py
index 79d97c719..5cc0c586b 100644
--- a/cyberdrop_dl/crawlers/bluesky/crawler.py
+++ b/cyberdrop_dl/crawlers/bluesky/crawler.py
@@ -133,12 +133,14 @@ def _extract_media(record: Mapping[str, Any]) -> Generator[Media]:
asset_path = path[:-1]
asset = operators.nested_itemgetter(*asset_path)(record) if asset_path else record
cid = blob["ref"]["$link"]
+ if (ratio := asset.get("aspectRatio")) and "$type" in ratio:
+ ratio.pop("$type")
yield Media(
type=asset.get("$type") or str(asset_path or "<UNKNOWN>"),
cid=cid,
name=asset.get("alt") or cid,
mime=blob["mimeType"],
- aspect_ratio=Resolution(**ratio) if (ratio := asset.get("aspectRatio")) else None,
+ aspect_ratio=Resolution(**ratio) if ratio else None,
)