html-get 2.17.1 → 2.18.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 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.17.1",
5
+ "version": "2.18.0",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "html-get": "bin/index.js"
@@ -1 +1 @@
1
- [[["domainWithoutSuffix","google"]],[["domainWithoutSuffix","youtube"]],[["domainWithoutSuffix","apple"]],[["domainWithoutSuffix","wordpress"]],[["domainWithoutSuffix","microsoft"]],[["domainWithoutSuffix","wikipedia"]],[["domainWithoutSuffix","blogspot"]],[["domainWithoutSuffix","vimeo"]],[["domainWithoutSuffix","github"]],[["domainWithoutSuffix","nytimes"]],[["domainWithoutSuffix","bbc"]],[["domainWithoutSuffix","twitter"]],[["domainWithoutSuffix","imdb"]],[["domainWithoutSuffix","huffingtonpost"]],[["domainWithoutSuffix","spotify"]],[["domainWithoutSuffix","theguardian"]],[["domainWithoutSuffix","telegraph"]],[["domainWithoutSuffix","pinterest"]],[["domainWithoutSuffix","slideshare"]],[["domain","x.com"]],[["domainWithoutSuffix","eventbrite"]],[["domainWithoutSuffix","techcrunch"]],[["domainWithoutSuffix","zoom"]],[["domain","abc.net.au"]],[["domainWithoutSuffix","yelp"]],[["domainWithoutSuffix","arxiv"]],[["domainWithoutSuffix","engadget"]],[["domainWithoutSuffix","soundcloud"]],[["domainWithoutSuffix","theverge"]],[["domainWithoutSuffix","stackoverflow"]],[["domainWithoutSuffix","gitlab"]],[["domainWithoutSuffix","flickr"]],[["domainWithoutSuffix","giphy"]],[["domainWithoutSuffix","imgur"]],[["domainWithoutSuffix","etsy"]],[["domainWithoutSuffix","csdn"]],[["domainWithoutSuffix","deviantart"]],[["domainWithoutSuffix","digg"]],[["domainWithoutSuffix","dribbble"]],[["domainWithoutSuffix","ghost"]],[["domainWithoutSuffix","meetup"]],[["domainWithoutSuffix","producthunt"]],[["domainWithoutSuffix","sourceforge"]],[["domainWithoutSuffix","substack"]],[["domainWithoutSuffix","tumblr"]],[["domainWithoutSuffix","ycombinator"]]]
1
+ [[["domainWithoutSuffix","youtube"]],[["domainWithoutSuffix","google"]],[["domainWithoutSuffix","apple"]],[["domainWithoutSuffix","wordpress"]],[["domainWithoutSuffix","microsoft"]],[["domainWithoutSuffix","wikipedia"]],[["domainWithoutSuffix","blogspot"]],[["domainWithoutSuffix","github"]],[["domain","x.com"]],[["domainWithoutSuffix","vimeo"]],[["domainWithoutSuffix","nytimes"]],[["domainWithoutSuffix","bbc"]],[["domainWithoutSuffix","imdb"]],[["domainWithoutSuffix","telegraph"]],[["domainWithoutSuffix","pinterest"]],[["domainWithoutSuffix","huffingtonpost"]],[["domainWithoutSuffix","spotify"]],[["domainWithoutSuffix","theguardian"]],[["domainWithoutSuffix","slideshare"]],[["domainWithoutSuffix","twitter"]],[["domainWithoutSuffix","arxiv"]],[["domainWithoutSuffix","techcrunch"]],[["domainWithoutSuffix","zoom"]],[["domainWithoutSuffix","engadget"]],[["domainWithoutSuffix","soundcloud"]],[["domainWithoutSuffix","eventbrite"]],[["domain","abc.net.au"]],[["domainWithoutSuffix","yelp"]],[["domainWithoutSuffix","theverge"]],[["domainWithoutSuffix","dribbble"]],[["domainWithoutSuffix","stackoverflow"]],[["domainWithoutSuffix","flickr"]],[["domainWithoutSuffix","csdn"]],[["domainWithoutSuffix","deviantart"]],[["domainWithoutSuffix","digg"]],[["domainWithoutSuffix","etsy"]],[["domainWithoutSuffix","ghost"]],[["domainWithoutSuffix","giphy"]],[["domainWithoutSuffix","gitlab"]],[["domainWithoutSuffix","imgur"]],[["domainWithoutSuffix","meetup"]],[["domainWithoutSuffix","producthunt"]],[["domainWithoutSuffix","sourceforge"]],[["domainWithoutSuffix","substack"]],[["domainWithoutSuffix","tumblr"]],[["domainWithoutSuffix","ycombinator"]]]
package/src/html.js CHANGED
@@ -91,7 +91,7 @@ const addBody = ({ url, headers, html }) => {
91
91
  }
92
92
 
93
93
  const isOpenGraph = (prop = '') =>
94
- ['og:', 'fb:'].some(prefix => prop.startsWith(prefix))
94
+ ['og:', 'fb:', 'al:'].some(prefix => prop.startsWith(prefix))
95
95
 
96
96
  const rewriteMetaTags = ({ $ }) => {
97
97
  $('meta').each((_, element) => {
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
  {