Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"request"
],
"dependencies": {
"@kikobeats/time-span": "~1.0.2",
"@metascraper/helpers": "~5.37.1",
"cheerio": "~1.0.0-rc.12",
"css-url-regex": "~4.0.0",
Expand All @@ -43,7 +44,6 @@
"p-cancelable": "~2.1.0",
"p-retry": "~4.6.0",
"replace-string": "~3.1.0",
"time-span": "~4.0.0",
"top-sites": "~1.1.169",
"write-json-file": "~4.3.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

const { parseUrl, isMediaUrl } = require('@metascraper/helpers')
const debug = require('debug-logfmt')('html-get')
const timeSpan = require('@kikobeats/time-span')
const PCancelable = require('p-cancelable')
const { AbortError } = require('p-retry')
const htmlEncode = require('html-encode')
const timeSpan = require('time-span')
const got = require('got')

const autoDomains = require('./auto-domains')
Expand Down Expand Up @@ -203,7 +203,7 @@ module.exports = PCancelable.fn(
const toEncode = htmlEncode(encoding)
const reqMode = getMode(targetUrl, { prerender })

const time = timeSpan()
const duration = timeSpan()

const promise = getContent(targetUrl, reqMode, {
getBrowserless,
Expand All @@ -218,7 +218,7 @@ module.exports = PCancelable.fn(

const { mode, ...payload } = await promise

return Object.assign(payload, { stats: { mode, timing: time.rounded() } })
return Object.assign(payload, { stats: { mode, timing: duration() } })
}
)

Expand Down