|
|
@ -345,10 +345,10 @@ class Site {
|
|
|
|
await sleep(1000)
|
|
|
|
await sleep(1000)
|
|
|
|
|
|
|
|
|
|
|
|
// Links
|
|
|
|
// Links
|
|
|
|
const links = await Promise.race([
|
|
|
|
const links = await (
|
|
|
|
|
|
|
|
await Promise.race([
|
|
|
|
this.timeout(),
|
|
|
|
this.timeout(),
|
|
|
|
(
|
|
|
|
page.evaluateHandle(() =>
|
|
|
|
await page.evaluateHandle(() =>
|
|
|
|
|
|
|
|
Array.from(document.getElementsByTagName('a')).map(
|
|
|
|
Array.from(document.getElementsByTagName('a')).map(
|
|
|
|
({ hash, hostname, href, pathname, protocol, rel }) => ({
|
|
|
|
({ hash, hostname, href, pathname, protocol, rel }) => ({
|
|
|
|
hash,
|
|
|
|
hash,
|
|
|
@ -359,15 +359,15 @@ class Site {
|
|
|
|
rel,
|
|
|
|
rel,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
).jsonValue(),
|
|
|
|
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
).jsonValue()
|
|
|
|
|
|
|
|
|
|
|
|
// CSS
|
|
|
|
// CSS
|
|
|
|
const css = await Promise.race([
|
|
|
|
const css = await (
|
|
|
|
|
|
|
|
await Promise.race([
|
|
|
|
this.timeout(),
|
|
|
|
this.timeout(),
|
|
|
|
(
|
|
|
|
page.evaluateHandle((maxRows) => {
|
|
|
|
await page.evaluateHandle((maxRows) => {
|
|
|
|
|
|
|
|
const css = []
|
|
|
|
const css = []
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -389,27 +389,27 @@ class Site {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return css.join('\n')
|
|
|
|
return css.join('\n')
|
|
|
|
}, this.options.htmlMaxRows)
|
|
|
|
}, this.options.htmlMaxRows),
|
|
|
|
).jsonValue(),
|
|
|
|
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
).jsonValue()
|
|
|
|
|
|
|
|
|
|
|
|
// Script tags
|
|
|
|
// Script tags
|
|
|
|
const scripts = await Promise.race([
|
|
|
|
const scripts = await (
|
|
|
|
|
|
|
|
await Promise.race([
|
|
|
|
this.timeout(),
|
|
|
|
this.timeout(),
|
|
|
|
(
|
|
|
|
page.evaluateHandle(() =>
|
|
|
|
await page.evaluateHandle(() =>
|
|
|
|
|
|
|
|
Array.from(document.getElementsByTagName('script'))
|
|
|
|
Array.from(document.getElementsByTagName('script'))
|
|
|
|
.map(({ src }) => src)
|
|
|
|
.map(({ src }) => src)
|
|
|
|
.filter((src) => src)
|
|
|
|
.filter((src) => src)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
).jsonValue(),
|
|
|
|
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
).jsonValue()
|
|
|
|
|
|
|
|
|
|
|
|
// Meta tags
|
|
|
|
// Meta tags
|
|
|
|
const meta = await Promise.race([
|
|
|
|
const meta = await (
|
|
|
|
|
|
|
|
await Promise.race([
|
|
|
|
this.timeout(),
|
|
|
|
this.timeout(),
|
|
|
|
(
|
|
|
|
page.evaluateHandle(() =>
|
|
|
|
await page.evaluateHandle(() =>
|
|
|
|
|
|
|
|
Array.from(document.querySelectorAll('meta')).reduce(
|
|
|
|
Array.from(document.querySelectorAll('meta')).reduce(
|
|
|
|
(metas, meta) => {
|
|
|
|
(metas, meta) => {
|
|
|
|
const key =
|
|
|
|
const key =
|
|
|
@ -423,9 +423,9 @@ class Site {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
).jsonValue(),
|
|
|
|
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
|
|
|
).jsonValue()
|
|
|
|
|
|
|
|
|
|
|
|
// JavaScript
|
|
|
|
// JavaScript
|
|
|
|
const js = await Promise.race([
|
|
|
|
const js = await Promise.race([
|
|
|
|