metascraper-instagram 5.46.0-beta.2 → 5.46.0
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 +4 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "metascraper-instagram",
|
|
3
3
|
"description": "Metascraper integration for Instagram",
|
|
4
4
|
"homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-instagram",
|
|
5
|
-
"version": "5.46.0
|
|
5
|
+
"version": "5.46.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"author": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"metascraper"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@metascraper/helpers": "5.46.0
|
|
26
|
+
"@metascraper/helpers": "5.46.0",
|
|
27
27
|
"franc": "~5.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"test": "NODE_PATH=.. TZ=UTC ava --timeout 15s"
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2c23249b6dd270afb6368aa756342a0514d90a19"
|
|
43
43
|
}
|
package/src/index.js
CHANGED
|
@@ -27,19 +27,19 @@ module.exports = () => {
|
|
|
27
27
|
const rules = {
|
|
28
28
|
author: ({ htmlDom: $ }) => {
|
|
29
29
|
const title = $('meta[property="og:title"]').attr('content')
|
|
30
|
-
const value = title
|
|
30
|
+
const value = title?.split(' on Instagram')[0]
|
|
31
31
|
return author(value)
|
|
32
32
|
},
|
|
33
33
|
date: ({ htmlDom: $, url }) => {
|
|
34
34
|
const description = getDescription(url, $)
|
|
35
|
-
const dateMatch = description
|
|
36
|
-
if (dateMatch === null) return
|
|
35
|
+
const dateMatch = description?.match(/on ([^,]+, \d{4})/)
|
|
36
|
+
if (dateMatch === null || dateMatch === undefined) return
|
|
37
37
|
const dateString = `${dateMatch[1]} GMT`
|
|
38
38
|
return date(new Date(dateString))
|
|
39
39
|
},
|
|
40
40
|
lang: ({ htmlDom: $, url }) => {
|
|
41
41
|
const description = getDescription(url, $)
|
|
42
|
-
const input = description
|
|
42
|
+
const input = description?.split(': ').pop()?.split(' - ').pop()
|
|
43
43
|
return detectLang(input)
|
|
44
44
|
},
|
|
45
45
|
title: ({ htmlDom: $ }) =>
|