metascraper-x 5.45.6-1 → 5.45.7

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 CHANGED
File without changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "metascraper-x",
3
3
  "description": "Metascraper integration for x.com",
4
4
  "homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-x",
5
- "version": "5.45.6-1",
5
+ "version": "5.45.7",
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.6",
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": "86ed64c8ef626bf651fa58618bb5dfa08d5a9f5a"
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,
@@ -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 = Array.from(getUrls(description))
49
+ const urls = getUrls(description)
51
50
 
52
51
  const resolvedUrls = await Promise.all(
53
52
  urls.map(async url => {
@@ -70,7 +69,7 @@ module.exports = ({
70
69
  image: [
71
70
  toImage($ => {
72
71
  let imageUrl = $('meta[property="og:image"]').attr('content')
73
- if (imageUrl.endsWith('_200x200.jpg')) {
72
+ if (imageUrl?.endsWith('_200x200.jpg')) {
74
73
  imageUrl = imageUrl.replace('_200x200.jpg', '_400x400.jpg')
75
74
  }
76
75
  return imageUrl