[bluesky] handle different 'embed' structure

pull/5280/head
Mike Fährmann 7 months ago
parent 1115dccd0d
commit 6482bbc525
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -107,10 +107,14 @@ class BlueskyExtractor(Extractor):
post["width"] = post["height"] = 0
image = file["image"]
post["filename"] = link = image["ref"]["$link"]
try:
cid = image["ref"]["$link"]
except KeyError:
cid = image["cid"]
post["filename"] = cid
post["extension"] = image["mimeType"].rpartition("/")[2]
yield Message.Url, base + link, post
yield Message.Url, base + cid, post
def posts(self):
return ()

@ -202,4 +202,12 @@ __tests__ = (
"uri" : "at://did:plc:cslxjqkeexku6elp5xowxkq7/app.bsky.feed.post/3kkzc3xaf5m2w",
},
{
"#url" : "https://bsky.app/profile/go-guiltism.bsky.social/post/3klgth6lilt2l",
"#comment" : "different embed CID path",
"#category": ("", "bluesky", "post"),
"#class" : bluesky.BlueskyPostExtractor,
"#urls" : "https://bsky.social/xrpc/com.atproto.sync.getBlob?did=did:plc:owc2r2dsewj3hk73rtd746zh&cid=bafkreieuhplc7fpbvi3suvacaf2dqxzvuu4hgl5o6eifqb76tf3uopldmi",
},
)

Loading…
Cancel
Save