html-get 2.9.24 → 2.9.26

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, using prerendering when is necessary.",
4
4
  "homepage": "https://nicedoc.com/microlinkhq/html-get",
5
- "version": "2.9.24",
5
+ "version": "2.9.26",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "html-get": "bin/index.js"
@@ -29,7 +29,7 @@
29
29
  "request"
30
30
  ],
31
31
  "dependencies": {
32
- "@metascraper/helpers": "~5.31.3",
32
+ "@metascraper/helpers": "~5.32.1",
33
33
  "cheerio": "~1.0.0-rc.12",
34
34
  "css-url-regex": "~4.0.0",
35
35
  "debug-logfmt": "~1.0.4",
@@ -1,36 +1,36 @@
1
1
  [
2
- "youtube",
3
2
  "google",
4
3
  "apple",
4
+ "youtube",
5
5
  "microsoft",
6
- "wikipedia",
7
6
  "wordpress",
7
+ "wikipedia",
8
8
  "blogspot",
9
9
  "vimeo",
10
10
  "github",
11
+ "theguardian",
11
12
  "bbc",
12
13
  "imdb",
13
- "theguardian",
14
- "nytimes",
15
14
  "slideshare",
16
- "huffingtonpost",
15
+ "nytimes",
17
16
  "soundcloud",
18
- "pinterest",
17
+ "huffingtonpost",
19
18
  "telegraph",
19
+ "pinterest",
20
+ "yelp",
20
21
  "zoom",
21
22
  "techcrunch",
22
- "spotify",
23
- "yelp",
23
+ "eventbrite",
24
24
  "engadget",
25
+ "spotify",
25
26
  "theverge",
26
- "eventbrite",
27
27
  "giphy",
28
- "digg",
29
- "imgur",
30
28
  "csdn",
29
+ "digg",
31
30
  "etsy",
32
31
  "flickr",
33
32
  "ghost",
33
+ "imgur",
34
34
  "meetup",
35
35
  "producthunt",
36
36
  "reddit",
package/src/html.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  const { get, split, nth, castArray, forEach } = require('lodash')
4
- const { parseUrl } = require('@metascraper/helpers')
5
4
  const { TAGS: URL_TAGS } = require('html-urls')
6
5
  const replaceString = require('replace-string')
7
6
  const isHTML = require('is-html-content')
@@ -13,9 +12,10 @@ const path = require('path')
13
12
 
14
13
  const {
15
14
  date: toDate,
16
- mimeExtension,
17
15
  isMime,
18
- isUrl
16
+ isUrl,
17
+ mimeExtension,
18
+ parseUrl
19
19
  } = require('@metascraper/helpers')
20
20
 
21
21
  const has = el => el.length !== 0
package/src/index.js CHANGED
@@ -18,12 +18,15 @@ const fetch = (
18
18
  { reflect = false, toEncode, timeout = REQ_TIMEOUT, ...opts }
19
19
  ) =>
20
20
  new PCancelable(async (resolve, reject, onCancel) => {
21
+ const reqTimeout = reflect ? timeout / 2 : timeout
22
+
21
23
  const req = got(url, {
22
- timeout: reflect ? timeout / 2 : timeout,
23
24
  ...opts,
25
+ timeout: reqTimeout,
24
26
  responseType: 'buffer'
25
27
  })
26
28
 
29
+ setTimeout(req.cancel, reqTimeout).unref()
27
30
  onCancel.shouldReject = false
28
31
 
29
32
  onCancel(() => {