diff --git a/src/extensions/ua-parser-extensions.js b/src/extensions/ua-parser-extensions.js index b2e31fb..7fff4c0 100644 --- a/src/extensions/ua-parser-extensions.js +++ b/src/extensions/ua-parser-extensions.js @@ -339,8 +339,9 @@ const Libraries = Object.freeze({ browser : [ // 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 [ - /^(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)\/([\w\.]+)/i, + /^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:httpx|urllib[23]?|requests)|scrapy)\/([\w\.]+)/i, + /(adobeair|aiohttp|jsdom)\/([\w\.]+)/i, + /(nutch)-([\w\.-]+)(\(|$)/i, /\((java)\/([\w\.]+)/i ], [NAME, VERSION, [TYPE, LIBRARY]] ] diff --git a/test/data/ua/extension/library.json b/test/data/ua/extension/library.json index f691105..17435a2 100644 --- a/test/data/ua/extension/library.json +++ b/test/data/ua/extension/library.json @@ -1,4 +1,24 @@ [ + { + "desc" : "AdobeAIR", + "ua" : "Mozilla/5.0 (Windows; U; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/3.1", + "expect" : + { + "name" : "AdobeAIR", + "version" : "3.1", + "type" : "library" + } + }, + { + "desc" : "aiohttp", + "ua" : "Python/3.9 aiohttp/3.8.1", + "expect" : + { + "name" : "aiohttp", + "version" : "3.8.1", + "type" : "library" + } + }, { "desc" : "Apache-HttpClient", "ua" : "Apache-HttpClient/4.5.14 (Java/17.0.12)", @@ -109,6 +129,16 @@ "type" : "library" } }, + { + "desc" : "Nutch", + "ua" : "AliyunSecBot/Nutch-1.21-SNAPSHOT", + "expect" : + { + "name" : "Nutch", + "version" : "1.21-SNAPSHOT", + "type" : "library" + } + }, { "desc" : "OkHttp", "ua" : "okhttp/3.2.0", @@ -149,6 +179,16 @@ "type" : "library" } }, + { + "desc" : "Python httpx", + "ua" : "python-httpx/0.27.2", + "expect" : + { + "name" : "python-httpx", + "version" : "0.27.2", + "type" : "library" + } + }, { "desc" : "Python urllib", "ua" : "Python-urllib/2.6", @@ -159,6 +199,16 @@ "type" : "library" } }, + { + "desc" : "Python urllib3", + "ua" : "python-urllib3/1.26.18", + "expect" : + { + "name" : "python-urllib3", + "version" : "1.26.18", + "type" : "library" + } + }, { "desc" : "Python requests", "ua" : "python-requests/2.32",