Fix handling of multiple same-name meta tags

main
Elbert Alias 3 years ago
parent 91bcf03f88
commit 6f80d7a618

@ -791,7 +791,11 @@ class Site {
meta.getAttribute('name') || meta.getAttribute('property')
if (key) {
metas[key.toLowerCase()] = [meta.getAttribute('content')]
metas[key.toLowerCase()] = metas[key.toLowerCase()] || []
metas[key.toLowerCase()].push(
meta.getAttribute('content')
)
}
return metas

@ -215,8 +215,12 @@ const Content = {
(metas, meta) => {
const key = meta.getAttribute('name') || meta.getAttribute('property')
console.log(key, meta.getAttribute('content'))
if (key) {
metas[key.toLowerCase()] = [meta.getAttribute('content')]
metas[key.toLowerCase()] = metas[key.toLowerCase()] || []
metas[key.toLowerCase()].push(meta.getAttribute('content'))
}
return metas

@ -209,8 +209,6 @@ const Driver = {
* Wrapper for analyze
*/
analyze(...args) {
Driver.log('analyze: Driver.analyze')
return analyze(...args)
},
@ -406,8 +404,6 @@ const Driver = {
)
})
Driver.log('analyze: onWebRequestComplete | headers')
Driver.onDetect(request.url, analyze({ headers })).catch(Driver.error)
}
} catch (error) {
@ -434,8 +430,6 @@ const Driver = {
const scripts = await response.text()
console.log('analyze: onScriptRequestComplete | scripts')
Driver.onDetect(request.documentUrl, analyze({ scripts })).catch(
Driver.error
)
@ -476,8 +470,6 @@ const Driver = {
xhrAnalyzed = {}
}
console.log('analyze: onXhrRequestComplete | xhr', hostname)
Driver.onDetect(
request.originUrl || request.initiator,
analyze({ xhr: hostname })
@ -508,8 +500,6 @@ const Driver = {
const technologies = getRequiredTechnologies(requires, categoryRequires)
Driver.log('analyze: onContentLoad | url, ...item')
await Driver.onDetect(
url,
analyze({ url, ...items }, technologies),

Loading…
Cancel
Save