Add CSS inspection to NPM driver

main
Elbert Alias 4 years ago
parent ff61200e5c
commit 2066f0c216

@ -363,6 +363,36 @@ class Site {
).jsonValue(), ).jsonValue(),
]) ])
// CSS
const css = await Promise.race([
this.timeout(),
(
await page.evaluateHandle((maxRows) => {
const css = []
try {
if (!document.styleSheets.length) {
return ''
}
for (const sheet of Array.from(document.styleSheets)) {
for (const rules of Array.from(sheet.cssRules)) {
css.push(rules.cssText)
if (css.length >= maxRows) {
break
}
}
}
} catch (error) {
return ''
}
return css.join('\n')
}, this.options.htmlMaxRows)
).jsonValue(),
])
// Script tags // Script tags
const scripts = await Promise.race([ const scripts = await Promise.race([
this.timeout(), this.timeout(),
@ -483,6 +513,7 @@ class Site {
url, url,
cookies, cookies,
html, html,
css,
scripts, scripts,
meta, meta,
}) })

@ -20,9 +20,14 @@
"type": "git", "type": "git",
"url": "https://github.com/aliasio/wappalyzer" "url": "https://github.com/aliasio/wappalyzer"
}, },
"funding": { "funding": [
{
"url": "https://github.com/sponsors/aliasio" "url": "https://github.com/sponsors/aliasio"
}, },
{
"url": "https://paypal.me/aliasio"
}
],
"main": "driver.js", "main": "driver.js",
"files": [ "files": [
"cli.js", "cli.js",

@ -20,9 +20,14 @@
"type": "git", "type": "git",
"url": "https://github.com/aliasio/wappalyzer" "url": "https://github.com/aliasio/wappalyzer"
}, },
"funding": { "funding": [
{
"url": "https://github.com/sponsors/aliasio" "url": "https://github.com/sponsors/aliasio"
}, },
{
"url": "https://paypal.me/aliasio"
}
],
"main": "wappalyzer.js", "main": "wappalyzer.js",
"files": [ "files": [
"wappalyzer.js" "wappalyzer.js"

@ -5014,6 +5014,10 @@
41 41
], ],
"html": "<[^>]+aria-labelledby=\"pi-google_pay", "html": "<[^>]+aria-labelledby=\"pi-google_pay",
"scripts": [
"checkout\\.google\\.com",
"wallet\\.google\\.com"
],
"icon": "Google.svg", "icon": "Google.svg",
"website": "https://pay.google.com" "website": "https://pay.google.com"
}, },
@ -5065,17 +5069,6 @@
}, },
"website": "http://www.google.com/tagmanager" "website": "http://www.google.com/tagmanager"
}, },
"Google Wallet": {
"cats": [
41
],
"icon": "Google Wallet.png",
"scripts": [
"checkout\\.google\\.com",
"wallet\\.google\\.com"
],
"website": "http://wallet.google.com"
},
"Google Web Server": { "Google Web Server": {
"cats": [ "cats": [
22 22
@ -10859,6 +10852,7 @@
}, },
"scripts": "sdks\\.shopifycdn\\.com", "scripts": "sdks\\.shopifycdn\\.com",
"url": "^https?//.+\\.myshopify\\.com", "url": "^https?//.+\\.myshopify\\.com",
"description": "Shopify is a commerce platform that allows anyone to set up a store and sell their products online or in person.",
"website": "http://shopify.com" "website": "http://shopify.com"
}, },
"Shopline": { "Shopline": {