metascraper-instagram 5.55.2 → 5.58.1
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/package.json +3 -3
- package/src/index.js +15 -5
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "metascraper-instagram",
|
|
3
3
|
"description": "Metascraper rules tailored for Instagram pages — richer metadata than generic HTML parsers.",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-instagram",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.58.1",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"social"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@metascraper/helpers": "5.
|
|
34
|
+
"@metascraper/helpers": "5.56.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"ava": "8"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "ba231caba2d7afe37e55921e88a77b02dafcdcf4"
|
|
50
50
|
}
|
package/src/index.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
|
+
$meta,
|
|
4
5
|
author,
|
|
5
6
|
date,
|
|
7
|
+
logo,
|
|
6
8
|
memoizeOne,
|
|
7
9
|
parseUrl,
|
|
8
|
-
title
|
|
10
|
+
title,
|
|
11
|
+
toRule
|
|
9
12
|
} = require('@metascraper/helpers')
|
|
10
13
|
|
|
14
|
+
const toLogo = toRule(logo)
|
|
15
|
+
|
|
11
16
|
const test = memoizeOne(
|
|
12
17
|
url => parseUrl(url).domainWithoutSuffix === 'instagram'
|
|
13
18
|
)
|
|
14
19
|
|
|
15
20
|
const getDescription = memoizeOne(
|
|
16
|
-
(_, $) => $('
|
|
21
|
+
(_, $) => $meta('og:description')($),
|
|
17
22
|
memoizeOne.EqualityFirstArgument
|
|
18
23
|
)
|
|
19
24
|
|
|
20
25
|
module.exports = () => {
|
|
21
26
|
const rules = {
|
|
22
27
|
author: ({ htmlDom: $ }) => {
|
|
23
|
-
const title = $('
|
|
28
|
+
const title = $meta('og:title')($)
|
|
24
29
|
const value = title?.split(' on Instagram')[0]
|
|
25
30
|
return author(value)
|
|
26
31
|
},
|
|
@@ -31,8 +36,13 @@ module.exports = () => {
|
|
|
31
36
|
const dateString = `${dateMatch[1]} GMT`
|
|
32
37
|
return date(new Date(dateString))
|
|
33
38
|
},
|
|
34
|
-
title: ({ htmlDom: $ }) =>
|
|
35
|
-
|
|
39
|
+
title: ({ htmlDom: $ }) => title($meta('twitter:title')($)),
|
|
40
|
+
// rel=icon claims 192x192 but the file is 32x32. The 180 apple-touch is real.
|
|
41
|
+
logo: [
|
|
42
|
+
toLogo($ =>
|
|
43
|
+
$('link[rel="apple-touch-icon"][sizes="180x180"]').attr('href')
|
|
44
|
+
)
|
|
45
|
+
]
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
rules.test = ({ url }) => test(url)
|