metascraper-x 5.49.8 → 5.49.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -7
- package/package.json +2 -2
- package/src/index.js +1 -2
package/README.md
CHANGED
|
@@ -20,17 +20,11 @@ $ npm install metascraper-x --save
|
|
|
20
20
|
|
|
21
21
|
#### options
|
|
22
22
|
|
|
23
|
-
##### resolveUrls
|
|
24
|
-
|
|
25
|
-
Type: `boolean`
|
|
26
|
-
|
|
27
|
-
Set to `true` if you want to resolve `t.co` URLs into the final URL.
|
|
28
|
-
|
|
29
23
|
##### resolveUrl
|
|
30
24
|
|
|
31
25
|
Type: `function`
|
|
32
26
|
|
|
33
|
-
The function implementation that resolves `t.co` into
|
|
27
|
+
The function implementation that resolves URLs (e.g., `t.co`) into the final URL.
|
|
34
28
|
|
|
35
29
|
## License
|
|
36
30
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "metascraper-x",
|
|
3
3
|
"description": "Metascraper integration with x.com",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-x",
|
|
5
|
-
"version": "5.49.
|
|
5
|
+
"version": "5.49.9",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"author": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "47690490a2eb1f6e3bcd47559fefeaa298c45eaa"
|
|
43
43
|
}
|
package/src/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const test = memoizeOne(url =>
|
|
|
25
25
|
['twitter.com', 'x.com'].includes(parseUrl(url).domain)
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
module.exports = ({
|
|
28
|
+
module.exports = ({ resolveUrl = url => url } = {}) => {
|
|
29
29
|
const rules = {
|
|
30
30
|
author: [
|
|
31
31
|
toAuthor($ => {
|
|
@@ -49,7 +49,6 @@ module.exports = ({ resolveUrls = false, resolveUrl = url => url } = {}) => {
|
|
|
49
49
|
$jsonld('mainEntity.description')($) ||
|
|
50
50
|
$('meta[property="og:description"]').attr('content')
|
|
51
51
|
|
|
52
|
-
if (!resolveUrls) return description
|
|
53
52
|
const urls = getUrls(description)
|
|
54
53
|
const resolvedUrls = await Promise.all(urls.map(resolveUrl))
|
|
55
54
|
|