Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsdom #627

Closed
tkrotoff opened this issue Jan 18, 2023 · 1 comment
Closed

jsdom #627

tkrotoff opened this issue Jan 18, 2023 · 1 comment

Comments

@tkrotoff
Copy link
Contributor

tkrotoff commented Jan 18, 2023

jsdom: https://github.com/jsdom/jsdom

jsdom is currently identified as WebKit which is incorrect.

window.navigator.userAgent for jsdom is Mozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/20.0.3

@faisalman
Copy link
Owner

In the meantime there is no support for jsdom, but you can add it now using extension: https://github.com/faisalman/ua-parser-js#extending-regex

const result = UAParser("Mozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/20.0.3", 
{ 
  browser : [[/(jsdom)\/([\d\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]]
});
console.log(result.browser); // { name: "jsdom", version: "20.0.3", major: "20" }

faisalman added a commit that referenced this issue Aug 15, 2023
Axios: `axios/VERSION`
https://www.zenrows.com/blog/axios-user-agent#what-is-axios-user-agent

JSDOM: `Mozilla/5.0 (${process.platform || "unknown OS"}) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/${jsdomVersion}`
https://github.com/jsdom/jsdom

Scrapy: `Scrapy/VERSION (+https://scrapy.org)`
https://docs.scrapy.org/en/master/topics/settings.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants