ua-parser-js
ua-parser-js copied to clipboard
Wget and Curl not recognized?
Hello, I just looked into this library and am very pleased with how it works.
I tested if it would fit my needs and found that it currently does not recognize programs like wget, curl, and lynx and thus does not read them into the browser.name or browser.version?
The userAgents I was able to see where:
Lynx: Lynx/2.8.9rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/1.1.1k (this actually extracted Lynx but no version)
Wget: Wget/1.21.1
Curl: curl/7.64.1
Would this be something to possibly add?
It doesn't detect them at the moment but if you want to use it by the current state, you can extend with your own list: https://github.com/faisalman/ua-parser-js#using-extension
var myOwnListOfBrowsers = [
[/(wget|curl|lynx)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
];
var myParser = new UAParser({ browser: myOwnListOfBrowsers });
var myUA = 'Wget/1.21.1';
console.log(myParser.setUA(myUA).getBrowser()); // {name: "Wget", version: "1.21.1"}
As for the possibility to be added in upcoming release is something I will consider.. Thanks 👍
@faisalman That's awesome, thanks you. Didn't catch the extension part at first.
Another one I saw is that insomnia/2021.2.1 (API Test App) didn't get recognized. (could be the same for postman API test tool)
I think those apps are all also interesting to at least know about.
Thank you for our consideration and help 🌸.