html-get 2.17.2 → 2.18.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 +1 -1
- package/scripts/postinstall +1 -0
- package/src/auto-domains.json +1 -1
- package/src/index.js +17 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "html-get",
|
|
3
3
|
"description": "Get the HTML from any website, fine-tuned for correction & speed",
|
|
4
4
|
"homepage": "https://nicedoc.com/microlinkhq/html-get",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.18.1",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"html-get": "bin/index.js"
|
package/scripts/postinstall
CHANGED
|
@@ -30,6 +30,7 @@ const domains = [
|
|
|
30
30
|
[['domainWithoutSuffix', 'huffingtonpost']],
|
|
31
31
|
[['domainWithoutSuffix', 'imdb']],
|
|
32
32
|
[['domainWithoutSuffix', 'imgur']],
|
|
33
|
+
[['domainWithoutSuffix', 'instagram']],
|
|
33
34
|
[['domainWithoutSuffix', 'meetup']],
|
|
34
35
|
[['domainWithoutSuffix', 'microsoft']],
|
|
35
36
|
[['domainWithoutSuffix', 'nytimes']],
|
package/src/auto-domains.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[[["domainWithoutSuffix","
|
|
1
|
+
[[["domainWithoutSuffix","youtube"]],[["domainWithoutSuffix","google"]],[["domainWithoutSuffix","wordpress"]],[["domainWithoutSuffix","apple"]],[["domainWithoutSuffix","microsoft"]],[["domainWithoutSuffix","wikipedia"]],[["domainWithoutSuffix","vimeo"]],[["domainWithoutSuffix","github"]],[["domainWithoutSuffix","blogspot"]],[["domainWithoutSuffix","bbc"]],[["domain","x.com"]],[["domainWithoutSuffix","imdb"]],[["domainWithoutSuffix","theguardian"]],[["domainWithoutSuffix","nytimes"]],[["domainWithoutSuffix","spotify"]],[["domainWithoutSuffix","huffingtonpost"]],[["domainWithoutSuffix","slideshare"]],[["domainWithoutSuffix","twitter"]],[["domainWithoutSuffix","instagram"]],[["domainWithoutSuffix","telegraph"]],[["domainWithoutSuffix","pinterest"]],[["domainWithoutSuffix","soundcloud"]],[["domain","abc.net.au"]],[["domainWithoutSuffix","zoom"]],[["domainWithoutSuffix","techcrunch"]],[["domainWithoutSuffix","yelp"]],[["domainWithoutSuffix","eventbrite"]],[["domainWithoutSuffix","engadget"]],[["domainWithoutSuffix","theverge"]],[["domainWithoutSuffix","arxiv"]],[["domainWithoutSuffix","etsy"]],[["domainWithoutSuffix","dribbble"]],[["domainWithoutSuffix","csdn"]],[["domainWithoutSuffix","deviantart"]],[["domainWithoutSuffix","digg"]],[["domainWithoutSuffix","flickr"]],[["domainWithoutSuffix","ghost"]],[["domainWithoutSuffix","giphy"]],[["domainWithoutSuffix","gitlab"]],[["domainWithoutSuffix","imgur"]],[["domainWithoutSuffix","meetup"]],[["domainWithoutSuffix","producthunt"]],[["domainWithoutSuffix","sourceforge"]],[["domainWithoutSuffix","stackoverflow"]],[["domainWithoutSuffix","substack"]],[["domainWithoutSuffix","tumblr"]],[["domainWithoutSuffix","ycombinator"]]]
|
package/src/index.js
CHANGED
|
@@ -49,6 +49,11 @@ const fetch = PCancelable.fn(
|
|
|
49
49
|
req.cancel()
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
+
const redirects = []
|
|
53
|
+
req.on('redirect', res =>
|
|
54
|
+
redirects.push({ statusCode: res.statusCode, url: res.url })
|
|
55
|
+
)
|
|
56
|
+
|
|
52
57
|
try {
|
|
53
58
|
const res = await req
|
|
54
59
|
|
|
@@ -70,7 +75,8 @@ const fetch = PCancelable.fn(
|
|
|
70
75
|
html,
|
|
71
76
|
mode: 'fetch',
|
|
72
77
|
url: res.url,
|
|
73
|
-
statusCode: res.statusCode
|
|
78
|
+
statusCode: res.statusCode,
|
|
79
|
+
redirects
|
|
74
80
|
}
|
|
75
81
|
} catch (error) {
|
|
76
82
|
debug('fetch:error', { url, message: error.message || error, reflect })
|
|
@@ -81,7 +87,8 @@ const fetch = PCancelable.fn(
|
|
|
81
87
|
html: '',
|
|
82
88
|
mode: 'fetch',
|
|
83
89
|
headers: error.response ? error.response.headers : {},
|
|
84
|
-
statusCode: error.response ? error.response.statusCode : undefined
|
|
90
|
+
statusCode: error.response ? error.response.statusCode : undefined,
|
|
91
|
+
redirects
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
}
|
|
@@ -126,7 +133,14 @@ const prerender = PCancelable.fn(
|
|
|
126
133
|
html: await page.content(),
|
|
127
134
|
mode: 'prerender',
|
|
128
135
|
url: response.url(),
|
|
129
|
-
statusCode: response.status()
|
|
136
|
+
statusCode: response.status(),
|
|
137
|
+
redirects: response
|
|
138
|
+
.request()
|
|
139
|
+
.redirectChain()
|
|
140
|
+
.map(req => ({
|
|
141
|
+
statusCode: req.response().status(),
|
|
142
|
+
url: req.url()
|
|
143
|
+
}))
|
|
130
144
|
}
|
|
131
145
|
},
|
|
132
146
|
{
|