[sub:extensions] Add new bots: Apache-HttpClient, go-http-client, got, GuzzleHttp, Java-http-client, libwww-perl, lua-resty-http, Needle, OkHttp, node-fetch, PHP-SOAP, PostmanRuntime, superagent

This commit is contained in:
Faisal Salman 2024-11-24 12:19:21 +07:00
parent f5ee90fcf8
commit 60cc84d58c
4 changed files with 141 additions and 5 deletions

View File

@ -375,8 +375,11 @@ const MediaPlayers = Object.freeze({
const Libraries = Object.freeze({ const Libraries = Object.freeze({
browser : [ browser : [
// Axios/jsdom/Scrapy/Java/urllib/requests // Apache-HttpClient/Axios/go-http-client/got/GuzzleHttp/Java[-HttpClient]/jsdom/libwww-perl/lua-resty-http/Needle/node-fetch/OkHttp/PHP-SOAP/PostmanRuntime/python-urllib/python-requests/Scrapy/superagent
[/\b(axios|jsdom|scrapy|java|python-urllib|python-requests)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, LIBRARY]] [
/^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:urllib|requests)|scrapy)\/([\w\.]+)/i,
/(jsdom|(?<=\()java)\/([\w\.]+)/i
], [NAME, VERSION, [TYPE, LIBRARY]]
] ]
}); });

View File

@ -379,8 +379,11 @@ const MediaPlayers = Object.freeze({
const Libraries = Object.freeze({ const Libraries = Object.freeze({
browser : [ browser : [
// Axios/jsdom/Scrapy/Java/urllib/requests // Apache-HttpClient/Axios/go-http-client/got/GuzzleHttp/Java[-HttpClient]/jsdom/libwww-perl/lua-resty-http/Needle/node-fetch/OkHttp/PHP-SOAP/PostmanRuntime/python-urllib/python-requests/Scrapy/superagent
[/\b(axios|jsdom|scrapy|java|python-urllib|python-requests)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, LIBRARY]] [
/^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:urllib|requests)|scrapy)\/([\w\.]+)/i,
/(jsdom|(?<=\()java)\/([\w\.]+)/i
], [NAME, VERSION, [TYPE, LIBRARY]]
] ]
}); });

View File

@ -22,7 +22,7 @@ describe('Extensions', () => {
.forEach((list) => { .forEach((list) => {
describe(list[0], () => { describe(list[0], () => {
list[1].forEach((agent) => { list[1].forEach((agent) => {
it(`Can detect ${agent.desc}`, () => { it(`Can detect ${agent.desc}: "${agent.ua}"`, () => {
let browser = UAParser(agent.ua, list[2]).browser; let browser = UAParser(agent.ua, list[2]).browser;
assert.strictEqual(String(browser.name), agent.expect.name); assert.strictEqual(String(browser.name), agent.expect.name);
assert.strictEqual(String(browser.version), agent.expect.version); assert.strictEqual(String(browser.version), agent.expect.version);

View File

@ -1,4 +1,14 @@
[ [
{
"desc" : "Apache-HttpClient",
"ua" : "Apache-HttpClient/4.5.14 (Java/17.0.12)",
"expect" :
{
"name" : "Apache-HttpClient",
"version" : "4.5.14",
"type" : "library"
}
},
{ {
"desc" : "Axios", "desc" : "Axios",
"ua" : "axios/1.7.2", "ua" : "axios/1.7.2",
@ -9,6 +19,36 @@
"type" : "library" "type" : "library"
} }
}, },
{
"desc" : "go-http-client",
"ua" : "go-http-client/1.1",
"expect" :
{
"name" : "go-http-client",
"version" : "1.1",
"type" : "library"
}
},
{
"desc" : "got",
"ua" : "got/9.6.0 (https://github.com/sindresorhus/got)",
"expect" :
{
"name" : "got",
"version" : "9.6.0",
"type" : "library"
}
},
{
"desc" : "GuzzleHttp",
"ua" : "GuzzleHttp/6.5.5 curl/7.70.0 PHP/7.4.22",
"expect" :
{
"name" : "GuzzleHttp",
"version" : "6.5.5",
"type" : "library"
}
},
{ {
"desc" : "Java", "desc" : "Java",
"ua" : "Java/1.6.0_14", "ua" : "Java/1.6.0_14",
@ -19,6 +59,16 @@
"type" : "library" "type" : "library"
} }
}, },
{
"desc" : "Java HTTPClient",
"ua" : "Java-http-client/11.0.6",
"expect" :
{
"name" : "Java-http-client",
"version" : "11.0.6",
"type" : "library"
}
},
{ {
"desc" : "jsdom", "desc" : "jsdom",
"ua" : "Mozilla/5.0 (unknown OS) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/11.12.0", "ua" : "Mozilla/5.0 (unknown OS) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/11.12.0",
@ -29,6 +79,76 @@
"type" : "library" "type" : "library"
} }
}, },
{
"desc" : "libwww-perl",
"ua" : "libwww-perl/6.05",
"expect" :
{
"name" : "libwww-perl",
"version" : "6.05",
"type" : "library"
}
},
{
"desc" : "lua-resty-http",
"ua" : "lua-resty-http/0.07 (Lua)",
"expect" :
{
"name" : "lua-resty-http",
"version" : "0.07",
"type" : "library"
}
},
{
"desc" : "Needle",
"ua" : "Needle/3.2.0 (Node.js v18.14.2; win32 x64)",
"expect" :
{
"name" : "Needle",
"version" : "3.2.0",
"type" : "library"
}
},
{
"desc" : "OkHttp",
"ua" : "okhttp/3.2.0",
"expect" :
{
"name" : "okhttp",
"version" : "3.2.0",
"type" : "library"
}
},
{
"desc" : "node-fetch",
"ua" : "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)",
"expect" :
{
"name" : "node-fetch",
"version" : "1.0",
"type" : "library"
}
},
{
"desc" : "PHP-SOAP",
"ua" : "PHP-SOAP/7.4.33",
"expect" :
{
"name" : "PHP-SOAP",
"version" : "7.4.33",
"type" : "library"
}
},
{
"desc" : "PostmanRuntime",
"ua" : "PostmanRuntime/7.26.5",
"expect" :
{
"name" : "PostmanRuntime",
"version" : "7.26.5",
"type" : "library"
}
},
{ {
"desc" : "Python urllib", "desc" : "Python urllib",
"ua" : "Python-urllib/2.6", "ua" : "Python-urllib/2.6",
@ -58,5 +178,15 @@
"version" : "1.5.0", "version" : "1.5.0",
"type" : "library" "type" : "library"
} }
},
{
"desc" : "superagent",
"ua" : "node-superagent/5.0.2",
"expect" :
{
"name" : "node-superagent",
"version" : "5.0.2",
"type" : "library"
}
} }
] ]