Skip to content

Commit a903923

Browse files
authored
chore(dribbble): first releae (#796)
1 parent b49f1cd commit a903923

File tree

12 files changed

+5156
-0
lines changed

12 files changed

+5156
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ const metascraper = require('metascraper')([
260260

261261
- [metascraper-amazon](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-amazon) – Metascraper integration for Amazon.
262262
- [metascraper-bluesky](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-bluesky) – Metascraper integration for Bluesky.
263+
- [metascraper-dribbble](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-dribbble) – Metascraper integration for Dribble.
263264
- [metascraper-instagram](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-instagram) – Metascraper integration for Instagram.
264265
- [metascraper-soundcloud](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-soundcloud) – Metascraper integration for SoundCloud.
265266
- [metascraper-spotify](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-spotify) – Metascraper integration for Spotify.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5+
6+
## [5.49.21](https://github.com/microlinkhq/metascraper/compare/v5.49.20...v5.49.21) (2026-01-27)
7+
8+
**Note:** Version bump only for package metascraper-dribbble
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<div align="center">
2+
<br>
3+
<img style="width: 500px; margin:3rem 0 1.5rem;" src="https://metascraper.js.org/static/logo-banner.png" alt="metascraper">
4+
<br>
5+
<br>
6+
<p align="center"><strong>metascraper-dribbble</strong>: Metascraper integration with Dribbble.</p>
7+
<p align="center">See our <a href="https://metascraper.js.org" target='_blank' rel='noopener noreferrer'>website</a> for more information.</p>
8+
<br>
9+
</div>
10+
11+
## Install
12+
13+
```bash
14+
$ npm install metascraper-dribbble --save
15+
```
16+
17+
## License
18+
19+
**metascraper-dribbble** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/metascraper/blob/master/LICENSE.md) License.<br>
20+
Authored and maintained by [Microlink](https://microlink.io) with help from [contributors](https://github.com/microlinkhq/metascraper/contributors).
21+
22+
> [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · X [@microlinkhq](https://dribbble/microlinkhq)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "metascraper-dribbble",
3+
"description": "Metascraper integration for Dribbble",
4+
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-dribbble",
5+
"version": "5.49.21",
6+
"types": "src/index.d.ts",
7+
"main": "src/index.js",
8+
"author": {
9+
"email": "[email protected]",
10+
"name": "microlink.io",
11+
"url": "https://microlink.io"
12+
},
13+
"repository": {
14+
"directory": "packages/metascraper-dribbble",
15+
"type": "git",
16+
"url": "git+https://github.com/microlinkhq/metascraper.git"
17+
},
18+
"bugs": {
19+
"url": "https://github.com/microlinkhq/metascraper/issues"
20+
},
21+
"keywords": [
22+
"metascraper",
23+
"dribbble"
24+
],
25+
"dependencies": {
26+
"@metascraper/helpers": "workspace:*"
27+
},
28+
"devDependencies": {
29+
"ava": "5"
30+
},
31+
"engines": {
32+
"node": ">= 16"
33+
},
34+
"files": [
35+
"src"
36+
],
37+
"scripts": {
38+
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
39+
},
40+
"license": "MIT"
41+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare function rules(): import('metascraper').Rules;
2+
export = rules;
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
'use strict'
2+
3+
const {
4+
$jsonld,
5+
memoizeOne,
6+
author,
7+
date,
8+
description,
9+
parseUrl,
10+
toRule
11+
} = require('@metascraper/helpers')
12+
13+
const toAuthor = toRule(author)
14+
const toDate = toRule(date)
15+
const toDescription = toRule(description)
16+
17+
const test = memoizeOne(url => parseUrl(url).domain === 'dribbble.com')
18+
19+
const parseMetaDescription = memoizeOne(description => {
20+
if (!description || !description.includes(' | ')) {
21+
return { author: null, description: null }
22+
}
23+
24+
const parts = description.split(' | ')
25+
// Remove the last part if it's "Connect with them on Dribbble..."
26+
if (
27+
parts.length > 1 &&
28+
parts[parts.length - 1].includes('Connect with them on Dribbble')
29+
) {
30+
parts.pop()
31+
}
32+
33+
return {
34+
author: parts.length > 0 ? parts[0] : null,
35+
description: parts.length > 1 ? parts.slice(1).join(' | ') : null
36+
}
37+
})
38+
39+
module.exports = () => {
40+
const rules = {
41+
author: [
42+
toAuthor($jsonld('creator.name')),
43+
toAuthor($ => {
44+
const description = $('meta[name="description"]').attr('content')
45+
const { author } = parseMetaDescription(description)
46+
return author
47+
}),
48+
toAuthor($ => $('h1').first().text())
49+
],
50+
description: [
51+
toDescription($ => {
52+
const desc = $('meta[name="description"]').attr('content')
53+
const { description } = parseMetaDescription(desc)
54+
return description
55+
})
56+
],
57+
date: [toDate($jsonld('uploadDate'))],
58+
publisher: () => 'Dribbble'
59+
}
60+
61+
rules.test = ({ url }) => test(url)
62+
63+
rules.pkgName = 'metascraper-dribbble'
64+
65+
return rules
66+
}
67+
68+
module.exports.test = test

0 commit comments

Comments
 (0)