Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,17 @@ const metascraper = require('metascraper')([

**Vendor specific**

- [metascraper-amazon](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-amazon) – Metascraper integration with Amazon.
- [metascraper-instagram](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-instagram) – Metascraper integration for Instagram.
- [metascraper-soundcloud](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-soundcloud) – Metascraper integration with SoundCloud.
- [metascraper-spotify](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-spotify) – Metascraper integration with Spotify.
- [metascraper-telegram](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-telegram) – Metascraper integration with Telegram.
- [metascraper-tiktok](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-tiktok) – Get TikTok metadata from HTML markup.
- [metascraper-uol](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-uol) – Metascraper integration for uol.com URLs.
- [metascraper-x](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-x) – Metascraper integration with x.com.
- [metascraper-youtube](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-youtube) – Metascraper integration with YouTube.
- [metascraper-amazon](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-amazon) – Metascraper integration for Amazon.
- [metascraper-bluesky](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-bluesky) – Metascraper integration for Bluesky.
- [metascraper-instagram](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-instagram) – Metascraper integration for Instagram.
- [metascraper-soundcloud](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-soundcloud) – Metascraper integration for SoundCloud.
- [metascraper-spotify](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-spotify) – Metascraper integration for Spotify.
- [metascraper-telegram](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-telegram) – Metascraper integration for Telegram.
- [metascraper-tiktok](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-tiktok) – Metascraper integration for TikTok.
- [metascraper-uol](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-uol) – Metascraper integration for UOL URLs.
- [metascraper-x](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-x) – Metascraper integration for X (formerly Twitter)
- [metascraper-youtube](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-youtube) – Metascraper integration for YouTube.


### Community

Expand Down
22 changes: 22 additions & 0 deletions packages/metascraper-bluesky/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div align="center">
<br>
<img style="width: 500px; margin:3rem 0 1.5rem;" src="https://metascraper.js.org/static/logo-banner.png" alt="metascraper">
<br>
<br>
<p align="center"><strong>metascraper-bluesky</strong>: Metascraper integration with Bluesky.</p>
<p align="center">See our <a href="https://metascraper.js.org" target='_blank' rel='noopener noreferrer'>website</a> for more information.</p>
<br>
</div>

## Install

```bash
$ npm install metascraper-bluesky --save
```

## License

**metascraper-bluesky** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/metascraper/blob/master/LICENSE.md) License.<br>
Authored and maintained by [Microlink](https://microlink.io) with help from [contributors](https://github.com/microlinkhq/metascraper/contributors).

> [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · X [@microlinkhq](https://Bluesky/microlinkhq)
42 changes: 42 additions & 0 deletions packages/metascraper-bluesky/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "metascraper-bluesky",
"description": "Metascraper integration with Bluesky",
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-bluesky",
"version": "5.49.19",
"types": "src/index.d.ts",
"main": "src/index.js",
"author": {
"email": "hello@microlink.io",
"name": "microlink.io",
"url": "https://microlink.io"
},
"repository": {
"directory": "packages/metascraper-bluesky",
"type": "git",
"url": "git+https://github.com/microlinkhq/metascraper.git"
},
"bugs": {
"url": "https://github.com/microlinkhq/metascraper/issues"
},
"keywords": [
"metascraper",
"bluesky",
"bsky"
],
"dependencies": {
"@metascraper/helpers": "workspace:*"
},
"devDependencies": {
"ava": "5"
},
"engines": {
"node": ">= 16"
},
"files": [
"src"
],
"scripts": {
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
},
"license": "MIT"
}
2 changes: 2 additions & 0 deletions packages/metascraper-bluesky/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare function rules(): import('metascraper').Rules;
export = rules;
42 changes: 42 additions & 0 deletions packages/metascraper-bluesky/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict'

const {
$jsonld,
image,
memoizeOne,
author,
parseUrl,
toRule
} = require('@metascraper/helpers')

const toImage = toRule(image)
const toAuthor = toRule(author)

const test = memoizeOne(url => parseUrl(url).domain === 'bsky.app')

const getHandle = url => new URL(url).pathname.split('/')[2]

module.exports = () => {
const rules = {
image: [
toImage(
($, url) =>
$(
`[data-testid="postThreadItem-by-${getHandle(
url
)}"] img[src*="feed_thumbnail"]`
).attr('src') || $('meta[property="og:image"]').attr('content')
)
],
author: [toAuthor($jsonld('mainEntity.name'))],
publisher: () => 'Bluesky'
}

rules.test = ({ url }) => test(url)

rules.pkgName = 'metascraper-bluesky'

return rules
}

module.exports.test = test
366 changes: 366 additions & 0 deletions packages/metascraper-bluesky/test/fixtures/post-image.html

Large diffs are not rendered by default.

537 changes: 537 additions & 0 deletions packages/metascraper-bluesky/test/fixtures/post-link.html

Large diffs are not rendered by default.

473 changes: 473 additions & 0 deletions packages/metascraper-bluesky/test/fixtures/post.html

Large diffs are not rendered by default.

381 changes: 381 additions & 0 deletions packages/metascraper-bluesky/test/fixtures/profile.html

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions packages/metascraper-bluesky/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict'

const { readFile } = require('fs/promises')
const { resolve } = require('path')
const test = require('ava')

const metascraperBluesky = require('metascraper-bluesky')

const createMetascraper = (...args) =>
require('metascraper')([
metascraperBluesky(...args),
require('metascraper-author')(),
require('metascraper-date')(),
require('metascraper-image')(),
require('metascraper-video')(),
require('metascraper-description')(),
require('metascraper-lang')(),
require('metascraper-publisher')(),
require('metascraper-title')(),
require('metascraper-url')()
])

test('from a profile', async t => {
const url = 'https://bsky.app/profile/stephenking.bsky.social'
const html = await readFile(resolve(__dirname, 'fixtures/profile.html'))
const metascraper = createMetascraper()
const metadata = await metascraper({ url, html })
t.snapshot(metadata)
})

test('from a post', async t => {
const url =
'https://bsky.app/profile/stephenking.bsky.social/post/3mddvy5bv6k27'
const html = await readFile(resolve(__dirname, 'fixtures/post.html'))
const metascraper = createMetascraper()
const metadata = await metascraper({ url, html })
t.snapshot(metadata)
})

test('from a post with a link', async t => {
const url = 'https://bsky.app/profile/forbes.com/post/3mdd7aj7pgs2x'
const html = await readFile(resolve(__dirname, 'fixtures/post-link.html'))
const metascraper = createMetascraper()
const metadata = await metascraper({ url, html })
t.snapshot(metadata)
})

test('from a post with an image', async t => {
const url =
'https://bsky.app/profile/glendunlap.bsky.social/post/3mdegyw3ves2t'
const html = await readFile(resolve(__dirname, 'fixtures/post-image.html'))
const metascraper = createMetascraper()
const metadata = await metascraper({ url, html })
t.snapshot(metadata)
})
70 changes: 70 additions & 0 deletions packages/metascraper-bluesky/test/snapshots/index.js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Snapshot report for `test/index.js`

The actual snapshot is saved in `index.js.snap`.

Generated by [AVA](https://avajs.dev).

## from a profile

> Snapshot 1

{
author: 'Stephen King',
date: '2023-05-11T21:21:33.660Z',
description: 'Writer',
image: 'https://cdn.bsky.app/img/avatar/plain/did:plc:h7obn4tkp47wn7gqh4oe5eij/bafkreictz5mfmy5mz6s6orrdgsmx3nr4vgog4kie4gezhdx2nhn2irhski@jpeg',
lang: 'en',
publisher: 'Bluesky',
title: 'Stephen King (@stephenking.bsky.social)',
url: 'https://bsky.app/profile/stephenking.bsky.social',
video: null,
}

## from a post

> Snapshot 1

{
author: 'Stephen King',
date: '2026-01-26T18:50:48.357Z',
description: 'The rightwing response to the murder of Alex Pretti is predictable: to outshout and talk over anyone taking another position. The shrillness on Twitter is especially grating, but again, not surprising. It’s Orwell’s doublespeak. If the man had a cell phone instead of a gun, yell louder.',
image: 'https://cdn.bsky.app/img/avatar/plain/did:plc:h7obn4tkp47wn7gqh4oe5eij/bafkreictz5mfmy5mz6s6orrdgsmx3nr4vgog4kie4gezhdx2nhn2irhski@jpeg',
lang: 'en',
publisher: 'Bluesky',
title: 'Stephen King (@stephenking.bsky.social)',
url: 'https://bsky.app/profile/stephenking.bsky.social/post/3mddvy5bv6k27',
video: 'https://t.gifs.bsky.app/dSPFt2cUQ2MAAAP3/godzilla-x-kong-the-new-empire-gxk.webm',
}

## from a post with a link

> Snapshot 1

{
author: 'Forbes',
date: '2026-01-26T12:03:53.754Z',
description: `Windows PCs ‘Suddenly’ Fail After Microsoft’s New Update␊
https://www.forbes.com/sites/zakdoffman/2026/01/25/windows-pcs-suddenly-fail-after-microsofts-new-update/?utm_source=bluesky&utm_medium=social&utm_campaign=forbes`,
image: 'https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:2w45zyhuklwihpdc7oj3mi63/bafkreicvw6wztjxyhdve5viri54bevoj2pdiks2hm3qxvscnlf74if5ytm@jpeg',
lang: 'en',
publisher: 'Bluesky',
title: 'Forbes (@forbes.com)',
url: 'https://bsky.app/profile/forbes.com/post/3mdd7aj7pgs2x',
video: 'https://t.gifs.bsky.app/HcQmbA9V2ykAAAP3/marching-penguins-national-geographic.webm',
}

## from a post with an image

> Snapshot 1

{
author: 'Glen Dunlap',
date: '2026-01-26T23:55:44.454Z',
description: 'Owliver decided to fly to another branch and check things out. He can look in my window from this spot! #Birds #Raptors #Nature #Photography',
image: 'https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:24xmtazrkaxh7kwx2ehginec/bafkreialfqefcq2xoumlw6ulbkfbamombpf5g56x3oncuxulwelcm6332i@jpeg',
lang: 'en',
publisher: 'Bluesky',
title: 'Glen Dunlap (@glendunlap.bsky.social)',
url: 'https://bsky.app/profile/glendunlap.bsky.social/post/3mdegyw3ves2t',
video: null,
}
Binary file not shown.
17 changes: 17 additions & 0 deletions packages/metascraper-bluesky/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict'

const test = require('ava')

const { test: validator } = require('..')

test('true', t => {
t.true(validator('https://bsky.app/profile/stephenking.bsky.social'))
})

test('false', t => {
t.false(
validator(
'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot'
)
)
})
Loading