Skip to content

Commit 95b1399

Browse files
committed
chore(bluesky): add fallback rules
1 parent 5471a47 commit 95b1399

File tree

7 files changed

+2026
-371
lines changed

7 files changed

+2026
-371
lines changed

packages/metascraper-bluesky/src/index.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ const getHandle = url => new URL(url).pathname.split('/')[2]
1919
module.exports = () => {
2020
const rules = {
2121
image: [
22-
toImage(
23-
($, url) =>
24-
$(
25-
`[data-testid="postThreadItem-by-${getHandle(
26-
url
27-
)}"] img[src*="feed_thumbnail"]`
28-
).attr('src') || $('meta[property="og:image"]').attr('content')
29-
)
22+
toImage(($, url) =>
23+
$(
24+
`[data-testid="postThreadItem-by-${getHandle(
25+
url
26+
)}"] img[src*="feed_thumbnail"]`
27+
).attr('src')
28+
),
29+
toImage($jsonld('mainEntity.image')),
30+
toImage($ => $('meta[property="og:image"]').attr('content'))
31+
],
32+
author: [
33+
toAuthor($jsonld('author.name')),
34+
toAuthor($jsonld('mainEntity.name'))
3035
],
31-
author: [toAuthor($jsonld('mainEntity.name'))],
3236
publisher: () => 'Bluesky'
3337
}
3438

0 commit comments

Comments
 (0)