Permalink
Browse files

Resolve urls fallbacking in prerendering

  • Loading branch information...
Kikobeats committed Jun 28, 2018
1 parent e351023 commit 4a7938fab232ba7f547d498322ef3342b840f3f6
Showing with 12 additions and 4 deletions.
  1. +5 −0 bin/cli/browserless.js
  2. +3 −1 bin/cli/extract-urls.js
  3. +2 −1 bin/cli/index.js
  4. +2 −2 package.json
@@ -0,0 +1,5 @@
'use strict'
const { createBrowserless } = require('html-get')
module.exports = createBrowserless()
@@ -6,10 +6,12 @@ const getHTML = require('html-get')
const cheerio = require('cheerio')
const { map } = require('lodash')
const browserless = require('./browserless')
const { isXmlUrl } = fromXML
const fromHTML = async (url, { selector, prerender, ...opts }) => {
const { html: rawHtml } = await getHTML(url, { prerender })
const { html: rawHtml } = await getHTML(url, { browserless, prerender })
const $ = cheerio.load(rawHtml)
const html = selector ? $(selector).html() : rawHtml
const urls = await getUrlsFromHtml({ url, html, ...opts })
@@ -10,6 +10,7 @@ const { ci } = require('ci-env')
const extractUrls = require('./extract-urls')
const renderError = require('./render-error')
const browserless = require('./browserless')
const pkg = require('../../package.json')
const getError = require('./get-error')
const getUrl = require('./get-url')
@@ -91,7 +92,7 @@ const cli = require('meow')(require('./help'), {
await build.start()
const urls = await extractUrls(url, opts)
const emitter = await urlint(urls, opts)
const emitter = await urlint(urls, { browserless, ...opts })
view({ total: size(urls), emitter, ...opts })
} catch (genericError) {
const error = getError(genericError)
@@ -32,14 +32,14 @@
"validate"
],
"dependencies": {
"@urlint/core": "~1.2.1",
"@urlint/core": "~1.3.1",
"chalk": "~2.4.1",
"cheerio": "~1.0.0-rc.2",
"ci-env": "~1.6.1",
"clean-stack": "~1.3.0",
"cosmiconfig": "~5.0.5",
"github-build": "~1.2.0",
"html-get": "~1.0.2",
"html-get": "~1.0.3",
"html-urls": "~2.0.0",
"lodash": "~4.17.10",
"meow": "~5.0.0",

0 comments on commit 4a7938f

Please sign in to comment.