html-get 2.9.15 → 2.9.17

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/README.md CHANGED
@@ -160,7 +160,7 @@ When is `true`, it will be rewritten CSS/HTML relatives URLs present in the HTML
160
160
 
161
161
  ## License
162
162
 
163
- **html-get** © [Microlink](https://microlink.io), Released under the [MIT](https://github.com/microlinkhq/html-get/blob/master/LICENSE.md) License.<br>
163
+ **html-get** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/html-get/blob/master/LICENSE.md) License.<br>
164
164
  Authored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlinkhq/html-get/contributors).
165
165
 
166
- > [microlink.io](https://microlink.io) · GitHub [@MicrolinkHQ](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)
166
+ > [microlink.io](https://microlink.io) · GitHub [microlinkhq](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)
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.15",
5
+ "version": "2.9.17",
6
6
  "main": "src/index.js",
7
7
  "bin": {
8
8
  "html-get": "bin/index.js"
@@ -79,7 +79,7 @@
79
79
  ],
80
80
  "scripts": {
81
81
  "clean": "rm -rf node_modules",
82
- "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
82
+ "contributors": "(git-authors-cli && finepack --sort-ignore-object-at ava && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
83
83
  "lint": "standard-markdown README.md && standard",
84
84
  "postinstall": "node scripts/postinstall",
85
85
  "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
@@ -94,9 +94,10 @@
94
94
  },
95
95
  "license": "MIT",
96
96
  "ava": {
97
+ "workerThreads": false,
97
98
  "files": [
98
- "!test/util.js",
99
- "test/**/*.js"
99
+ "test/**/*.js",
100
+ "!test/util.js"
100
101
  ],
101
102
  "timeout": "2m"
102
103
  },
@@ -1,34 +1,34 @@
1
1
  [
2
+ "apple",
2
3
  "youtube",
3
4
  "google",
4
- "apple",
5
5
  "microsoft",
6
- "wordpress",
7
6
  "wikipedia",
7
+ "wordpress",
8
8
  "blogspot",
9
- "github",
10
9
  "vimeo",
11
- "slideshare",
12
- "imdb",
10
+ "github",
13
11
  "bbc",
14
- "theguardian",
15
12
  "nytimes",
13
+ "theguardian",
14
+ "imdb",
15
+ "slideshare",
16
16
  "huffingtonpost",
17
+ "soundcloud",
17
18
  "telegraph",
18
19
  "pinterest",
19
- "yelp",
20
20
  "eventbrite",
21
21
  "engadget",
22
22
  "zoom",
23
23
  "techcrunch",
24
- "theverge",
24
+ "yelp",
25
25
  "spotify",
26
- "soundcloud",
27
- "etsy",
26
+ "theverge",
28
27
  "flickr",
29
28
  "stackoverflow",
30
- "csdn",
31
29
  "digg",
30
+ "etsy",
31
+ "csdn",
32
32
  "ghost",
33
33
  "giphy",
34
34
  "imgur",
package/src/html.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const { startsWith, get, split, nth, castArray, forEach } = require('lodash')
4
3
  const { date: toDate, isUrl, isMime } = require('@metascraper/helpers')
4
+ const { get, split, nth, castArray, forEach } = require('lodash')
5
5
  const { TAGS: URL_TAGS } = require('html-urls')
6
6
  const replaceString = require('replace-string')
7
7
  const isHTML = require('is-html-content')
@@ -75,7 +75,8 @@ const rewriteHtmlUrls = ({ $, url }) => {
75
75
  $(tagName.join(',')).each(function () {
76
76
  const el = $(this)
77
77
  const attr = el.attr(urlAttr)
78
- if (startsWith(attr, '/')) {
78
+
79
+ if (typeof attr === 'string' && !attr.startsWith('http')) {
79
80
  try {
80
81
  const newAttr = new URL(attr, url).toString()
81
82
  el.attr(urlAttr, newAttr)
@@ -166,5 +167,3 @@ module.exports = ({
166
167
 
167
168
  return rewriteUrls ? rewriteCssUrls({ html: $.html(), url }) : $.html()
168
169
  }
169
-
170
- module.exports.isHTML = isHTML
package/src/index.js CHANGED
@@ -161,7 +161,7 @@ module.exports = async (
161
161
  rewriteUrls = false
162
162
  } = {}
163
163
  ) => {
164
- if (!getBrowserless) {
164
+ if (!getBrowserless && prerender !== false) {
165
165
  throw TypeError(
166
166
  "Need to provide a `getBrowserless` function. Try to pass `getBrowserless: require('browserless')`"
167
167
  )