metascraper-x 5.45.6-2 → 5.45.8
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/LICENSE.md +0 -0
- package/README.md +1 -1
- package/package.json +7 -7
- package/src/index.js +3 -4
package/LICENSE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<img style="width: 500px; margin:3rem 0 1.5rem;" src="https://metascraper.js.org/static/logo-banner.png" alt="metascraper">
|
|
4
4
|
<br>
|
|
5
5
|
<br>
|
|
6
|
-
<p align="center"><strong>metascraper-x</strong>: Metascraper integration
|
|
6
|
+
<p align="center"><strong>metascraper-x</strong>: Metascraper integration with x.com.</p>
|
|
7
7
|
<p align="center">See our <a href="https://metascraper.js.org" target='_blank' rel='noopener noreferrer'>website</a> for more information.</p>
|
|
8
8
|
<br>
|
|
9
9
|
</div>
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metascraper-x",
|
|
3
|
-
"description": "Metascraper integration
|
|
3
|
+
"description": "Metascraper integration with x.com",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-x",
|
|
5
|
-
"version": "5.45.
|
|
5
|
+
"version": "5.45.8",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"author": {
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"spotify"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@metascraper/helpers": "^5.45.
|
|
28
|
-
"get-urls": "~10.0.1"
|
|
27
|
+
"@metascraper/helpers": "^5.45.7"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"ava": "5"
|
|
@@ -36,8 +35,9 @@
|
|
|
36
35
|
"files": [
|
|
37
36
|
"src"
|
|
38
37
|
],
|
|
39
|
-
"license": "MIT",
|
|
40
38
|
"scripts": {
|
|
41
39
|
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
|
|
42
|
-
}
|
|
43
|
-
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"gitHead": "ddd759edb19eef06342b099fea7ee7b0d4a6fafb"
|
|
43
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const reachableUrl = require('reachable-url')
|
|
4
|
-
const getUrls = require('get-urls')
|
|
5
|
-
|
|
6
4
|
const {
|
|
5
|
+
getUrls,
|
|
7
6
|
author,
|
|
8
7
|
image,
|
|
9
8
|
memoizeOne,
|
|
@@ -39,7 +38,7 @@ module.exports = ({
|
|
|
39
38
|
title: [toTitle(($, url) => `@${url.split('/')[3]} on X`)],
|
|
40
39
|
url: [
|
|
41
40
|
toUrl($ =>
|
|
42
|
-
$('link[rel="canonical"]').attr('href')
|
|
41
|
+
$('link[rel="canonical"]').attr('href')?.replace('twitter.com', 'x.com')
|
|
43
42
|
)
|
|
44
43
|
],
|
|
45
44
|
description: [
|
|
@@ -47,7 +46,7 @@ module.exports = ({
|
|
|
47
46
|
let description = $('meta[property="og:description"]').attr('content')
|
|
48
47
|
if (!resolveUrls) return description
|
|
49
48
|
|
|
50
|
-
const urls =
|
|
49
|
+
const urls = getUrls(description)
|
|
51
50
|
|
|
52
51
|
const resolvedUrls = await Promise.all(
|
|
53
52
|
urls.map(async url => {
|