[bluesky] handle different 'embed' structure
This commit is contained in:
@@ -107,10 +107,14 @@ class BlueskyExtractor(Extractor):
|
|||||||
post["width"] = post["height"] = 0
|
post["width"] = post["height"] = 0
|
||||||
|
|
||||||
image = file["image"]
|
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]
|
post["extension"] = image["mimeType"].rpartition("/")[2]
|
||||||
|
|
||||||
yield Message.Url, base + link, post
|
yield Message.Url, base + cid, post
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
return ()
|
return ()
|
||||||
|
|||||||
@@ -202,4 +202,12 @@ __tests__ = (
|
|||||||
"uri" : "at://did:plc:cslxjqkeexku6elp5xowxkq7/app.bsky.feed.post/3kkzc3xaf5m2w",
|
"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",
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user