html-get 2.9.19 → 2.9.22
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 +7 -7
- package/src/auto-domains.json +15 -15
- package/src/html.js +13 -3
- package/src/index.js +1 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "html-get",
|
|
3
3
|
"description": "Get the HTML from any website, using prerendering when is necessary.",
|
|
4
4
|
"homepage": "https://nicedoc.com/microlinkhq/html-get",
|
|
5
|
-
"version": "2.9.
|
|
5
|
+
"version": "2.9.22",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"html-get": "bin/index.js"
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"request"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@metascraper/helpers": "~5.
|
|
33
|
-
"cheerio": "~1.0.0-rc.
|
|
32
|
+
"@metascraper/helpers": "~5.30.2",
|
|
33
|
+
"cheerio": "~1.0.0-rc.12",
|
|
34
34
|
"css-url-regex": "~4.0.0",
|
|
35
35
|
"debug-logfmt": "~1.0.4",
|
|
36
36
|
"execall": "~2.0.0",
|
|
37
|
-
"got": "~11.8.
|
|
37
|
+
"got": "~11.8.5",
|
|
38
38
|
"html-encode": "~2.1.6",
|
|
39
|
-
"html-urls": "~2.4.
|
|
39
|
+
"html-urls": "~2.4.37",
|
|
40
40
|
"is-html-content": "~1.0.0",
|
|
41
41
|
"lodash": "~4.17.21",
|
|
42
42
|
"minimist": "~1.2.6",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"p-retry": "~4.6.0",
|
|
45
45
|
"replace-string": "~3.1.0",
|
|
46
46
|
"time-span": "~4.0.0",
|
|
47
|
-
"tldts": "~5.7.
|
|
48
|
-
"top-sites": "~1.1.
|
|
47
|
+
"tldts": "~5.7.89",
|
|
48
|
+
"top-sites": "~1.1.117",
|
|
49
49
|
"write-json-file": "~4.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
package/src/auto-domains.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
[
|
|
2
|
-
"apple",
|
|
3
2
|
"google",
|
|
4
3
|
"youtube",
|
|
4
|
+
"apple",
|
|
5
5
|
"microsoft",
|
|
6
|
-
"wikipedia",
|
|
7
6
|
"wordpress",
|
|
7
|
+
"wikipedia",
|
|
8
8
|
"blogspot",
|
|
9
|
-
"github",
|
|
10
9
|
"vimeo",
|
|
10
|
+
"github",
|
|
11
|
+
"imdb",
|
|
11
12
|
"bbc",
|
|
12
|
-
"theguardian",
|
|
13
|
-
"slideshare",
|
|
14
13
|
"nytimes",
|
|
15
|
-
"
|
|
14
|
+
"slideshare",
|
|
15
|
+
"theguardian",
|
|
16
|
+
"huffingtonpost",
|
|
17
|
+
"soundcloud",
|
|
16
18
|
"telegraph",
|
|
17
19
|
"pinterest",
|
|
18
|
-
"soundcloud",
|
|
19
|
-
"huffingtonpost",
|
|
20
|
-
"engadget",
|
|
21
|
-
"zoom",
|
|
22
|
-
"techcrunch",
|
|
23
|
-
"eventbrite",
|
|
24
20
|
"spotify",
|
|
25
21
|
"yelp",
|
|
22
|
+
"eventbrite",
|
|
23
|
+
"engadget",
|
|
26
24
|
"theverge",
|
|
25
|
+
"techcrunch",
|
|
26
|
+
"zoom",
|
|
27
27
|
"flickr",
|
|
28
|
+
"stackoverflow",
|
|
28
29
|
"reddit",
|
|
29
|
-
"digg",
|
|
30
30
|
"giphy",
|
|
31
|
-
"csdn",
|
|
32
31
|
"etsy",
|
|
32
|
+
"digg",
|
|
33
|
+
"csdn",
|
|
33
34
|
"ghost",
|
|
34
35
|
"imgur",
|
|
35
36
|
"meetup",
|
|
36
37
|
"producthunt",
|
|
37
38
|
"sourceforge",
|
|
38
|
-
"stackoverflow",
|
|
39
39
|
"tumblr",
|
|
40
40
|
"ycombinator"
|
|
41
41
|
]
|
package/src/html.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { date: toDate, isUrl, isMime } = require('@metascraper/helpers')
|
|
4
3
|
const { get, split, nth, castArray, forEach } = require('lodash')
|
|
5
4
|
const { TAGS: URL_TAGS } = require('html-urls')
|
|
6
5
|
const replaceString = require('replace-string')
|
|
@@ -12,6 +11,13 @@ const cheerio = require('cheerio')
|
|
|
12
11
|
const { URL } = require('url')
|
|
13
12
|
const path = require('path')
|
|
14
13
|
|
|
14
|
+
const {
|
|
15
|
+
date: toDate,
|
|
16
|
+
mimeExtension,
|
|
17
|
+
isMime,
|
|
18
|
+
isUrl
|
|
19
|
+
} = require('@metascraper/helpers')
|
|
20
|
+
|
|
15
21
|
const has = el => el.length !== 0
|
|
16
22
|
|
|
17
23
|
const upsert = (el, collection, item) => !has(el) && collection.push(item)
|
|
@@ -54,7 +60,7 @@ const addHead = ({ $, url, headers }) => {
|
|
|
54
60
|
tags.forEach(tag => head.append(tag))
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
const addBody = ({ url, headers }) => {
|
|
63
|
+
const addBody = ({ url, headers, html }) => {
|
|
58
64
|
const contentType = get(headers, 'content-type')
|
|
59
65
|
|
|
60
66
|
let element = ''
|
|
@@ -65,6 +71,8 @@ const addBody = ({ url, headers }) => {
|
|
|
65
71
|
element = `<video src="${url}"></video>`
|
|
66
72
|
} else if (isMime(contentType, 'audio')) {
|
|
67
73
|
element = `<audio src="${url}"></audio>`
|
|
74
|
+
} else if (mimeExtension(contentType) === 'json') {
|
|
75
|
+
element = `<pre>${html}</pre>`
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
return `<!DOCTYPE html><html><head></head><body>${element}</body></html>`
|
|
@@ -138,7 +146,9 @@ module.exports = ({
|
|
|
138
146
|
scripts,
|
|
139
147
|
modules
|
|
140
148
|
}) => {
|
|
141
|
-
const content = addDocType(
|
|
149
|
+
const content = addDocType(
|
|
150
|
+
isHTML(html) ? html : addBody({ url, headers, html })
|
|
151
|
+
)
|
|
142
152
|
|
|
143
153
|
const $ = cheerio.load(content)
|
|
144
154
|
|
package/src/index.js
CHANGED
|
@@ -140,6 +140,7 @@ const getContent = async (
|
|
|
140
140
|
? { headers, toEncode, ...gotOpts }
|
|
141
141
|
: { headers, toEncode, getBrowserless, gotOpts, ...puppeteerOpts }
|
|
142
142
|
const content = await modes[mode](url, fetchOpts)
|
|
143
|
+
|
|
143
144
|
const html = addHtml({
|
|
144
145
|
...content,
|
|
145
146
|
...(isFetchMode ? puppeteerOpts : undefined),
|