simple-wappalyzer 1.1.78 → 1.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +11 -8
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "simple-wappalyzer",
3
3
  "description": "A simple way to interacting with Wappalyzer.",
4
4
  "homepage": "https://github.com/Kikobeats/simple-wappalyzer",
5
- "version": "1.1.78",
5
+ "version": "1.1.79",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
package/src/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const { chain, mapValues } = require('lodash')
4
4
  const wappalyzer = require('wappalyzer-core')
5
5
  const { Cookie } = require('tough-cookie')
6
- const { Window } = require('happy-dom')
6
+ const { Browser } = require('happy-dom')
7
7
 
8
8
  const technologies = require('./technologies.json')
9
9
  const categories = require('./categories.json')
@@ -42,8 +42,7 @@ const getMeta = document =>
42
42
  }, {})
43
43
 
44
44
  module.exports = async ({ url, headers, html }) => {
45
- const window = new Window({
46
- url,
45
+ const browser = new Browser({
47
46
  settings: {
48
47
  disableComputedStyleRendering: true,
49
48
  disableCSSFileLoading: true,
@@ -53,19 +52,23 @@ module.exports = async ({ url, headers, html }) => {
53
52
  }
54
53
  })
55
54
 
56
- window.document.documentElement.innerHTML = html
55
+ const page = browser.newPage()
56
+ page.url = url
57
+ page.content = html
58
+
59
+ const document = page.mainFrame.document
57
60
 
58
61
  const detections = await wappalyzer.analyze({
59
62
  url,
60
- meta: getMeta(window.document),
63
+ meta: getMeta(document),
61
64
  headers: getHeaders(headers),
62
- scripts: getScripts(window.document.scripts),
65
+ scripts: getScripts(document.scripts),
63
66
  cookies: getCookies(getHeader(headers, 'set-cookie')),
64
- html: window.document.documentElement.outerHTML
67
+ html: document.documentElement.outerHTML
65
68
  })
66
69
 
67
70
  const result = wappalyzer.resolve(detections)
68
- window.close()
71
+ await browser.close()
69
72
 
70
73
  return result
71
74
  }