Skip to content

Commit

Permalink
[submodule:extensions] Add new library: java, python-urllib, `pyt…
Browse files Browse the repository at this point in the history
…hon-requests`
  • Loading branch information
faisalman committed Nov 15, 2024
1 parent 4a12562 commit 14caf6d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/extensions/ua-parser-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ const MediaPlayers = Object.freeze({
], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [

/(htc streaming player)\s[\w_]+\s\/\s([\d\.]+)/i, // HTC Streaming Player
/(java|python-urllib|python-requests|wget|libcurl)\/([\w\.-_]+)/i,
// Java/urllib/requests/wget/cURL
/(lavf)([\d\.]+)/i // Lavf (FFMPEG)
], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [

Expand Down Expand Up @@ -370,8 +368,8 @@ const MediaPlayers = Object.freeze({

const Libraries = Object.freeze({
browser : [
// Axios/jsdom/Scrapy
[/\b(axios|jsdom|scrapy)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, LIBRARY]]
// Axios/jsdom/Scrapy/Java/urllib/requests
[/\b(axios|jsdom|scrapy|java|python-urllib|python-requests)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, LIBRARY]]
]
});

Expand Down
50 changes: 50 additions & 0 deletions test/specs/browser-libraries.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
[
{
"desc" : "Axios",
"ua" : "axios/1.7.2",
"expect" :
{
"name" : "axios",
"version" : "1.7.2",
"type" : "library"
}
},
{
"desc" : "Java",
"ua" : "Java/1.6.0_14",
"expect" :
{
"name" : "Java",
"version" : "1.6.0_14",
"type" : "library"
}
},
{
"desc" : "jsdom",
"ua" : "Mozilla/5.0 (unknown OS) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/11.12.0",
"expect" :
{
"name" : "jsdom",
"version" : "11.12.0",
"type" : "library"
}
},
{
"desc" : "Python urllib",
"ua" : "Python-urllib/2.6",
"expect" :
{
"name" : "Python-urllib",
"version" : "2.6",
"type" : "library"
}
},
{
"desc" : "Python requests",
"ua" : "python-requests/2.32",
"expect" :
{
"name" : "python-requests",
"version" : "2.32",
"type" : "library"
}
},
{
"desc" : "Scrapy",
"ua" : "Scrapy/1.5.0 (+https://scrapy.org)",
Expand Down

0 comments on commit 14caf6d

Please sign in to comment.