Skip to content

Commit 38baf84

Browse files
committed
Update version to 2.0.0
1 parent 70b3003 commit 38baf84

16 files changed

+141
-42
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
- **`'ua-parser-js/helpers'`**: Provides utility methods to extend detection functionality:
5656
- `getDeviceVendor()`: Guesses the device vendor based on its model name
5757
- `isAppleSilicon()`: Detects Apple Silicon device properties
58-
- `isBot()`: Checks if the browser is a bot
58+
- `isAIBot()`: Checks if the user-agent is an AI bot
59+
- `isBot()`: Checks if the user-agent is a bot
5960
- `isChromeFamily()`: Checks if the browser is Chrome-based (uses Blink engine) — e.g., New Opera, New Edge, Vivaldi, Brave, Arc, etc.
6061
- `isElectron()`: Detects if current window is running within Electron
6162
- `isFromEU()`: Detects if current browser's timezone is from an EU country
@@ -64,6 +65,17 @@
6465

6566
---
6667

68+
## Version 2.0.0
69+
70+
- `ua-parser-js/extensions` submodule:
71+
- Add new CLI: ELinks, HTTPie
72+
- Add new crawler: AI2Bot, aiHitBot, anthropic-ai, Diffbot, ImagesiftBot, magpie-crawler, Omgilibot, Screaming Frog SEO Spider, Seznambot, Teoma, Timpibot, VelenPublicWebCrawler, Webzio-Extended, YouBot
73+
- Add new email: Airmail, BlueMail, eMClient, NaverMailApp, Sparrow, Yahoo
74+
- Add new fetcher: cohere-ai, Vercelbot
75+
- Add new library: java, python-urllib, python-requests
76+
- `ua-parser-js/helpers` submodule:
77+
- Add new method `isAIBot()`: Checks if the user-agent is an AI bot
78+
6779
## Version 2.0.0-rc.3
6880

6981
- Add support for Headers object

dist/ua-parser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ua-parser.pack.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "UAParser.js",
33
"name": "ua-parser-js",
4-
"version": "2.0.0-rc.3",
4+
"version": "2.0.0",
55
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
66
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
77
"keywords": [
@@ -180,7 +180,8 @@
180180
},
181181
"./enums": {
182182
"require": "./src/enums/ua-parser-enums.js",
183-
"import": "./src/enums/ua-parser-enums.mjs"
183+
"import": "./src/enums/ua-parser-enums.mjs",
184+
"types": "./src/enums/ua-parser-enums.d.ts"
184185
},
185186
"./extensions": {
186187
"require": "./src/extensions/ua-parser-extensions.js",

src/enums/ua-parser-enums.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////
2-
/* Enums for UAParser.js v2.0.0-rc.3
2+
/* Enums for UAParser.js v2.0.0
33
https://github.com/faisalman/ua-parser-js
44
Author: Faisal Salman <f@faisalman.com>
55
AGPLv3 License */

src/enums/ua-parser-enums.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Source: /src/enums/ua-parser-enums.js
44

55
///////////////////////////////////////////////
6-
/* Enums for UAParser.js v2.0.0-rc.3
6+
/* Enums for UAParser.js v2.0.0
77
https://github.com/faisalman/ua-parser-js
88
Author: Faisal Salman <f@faisalman.com>
99
AGPLv3 License */

src/extensions/ua-parser-extensions.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
1+
// Type definitions for Helpers submodule of UAParser.js v2.0.0
22
// Project: https://github.com/faisalman/ua-parser-js
33
// Definitions by: Faisal Salman <https://github.com/faisalman>
44

src/extensions/ua-parser-extensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////
2-
/* Extensions for UAParser.js v2.0.0-rc.3
2+
/* Extensions for UAParser.js v2.0.0
33
https://github.com/faisalman/ua-parser-js
44
Author: Faisal Salman <f@faisalman.com>
55
AGPLv3 License */

src/extensions/ua-parser-extensions.mjs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Source: /src/extensions/ua-parser-extensions.js
44

55
///////////////////////////////////////////////
6-
/* Extensions for UAParser.js v2.0.0-rc.3
6+
/* Extensions for UAParser.js v2.0.0
77
https://github.com/faisalman/ua-parser-js
88
Author: Faisal Salman <f@faisalman.com>
99
AGPLv3 License */
@@ -32,8 +32,8 @@ const LIBRARY = 'library';
3232

3333
const CLIs = Object.freeze({
3434
browser : [
35-
// wget / curl / lynx
36-
[/(wget|curl|lynx)[\/ ]([\w\.]+)/i], [NAME, VERSION, [TYPE, CLI]]
35+
// wget / curl / Lynx / ELinks / HTTPie
36+
[/(wget|curl|lynx|elinks|httpie)[\/ ]\(?([\w\.-]+)/i], [NAME, VERSION, [TYPE, CLI]]
3737
]
3838
});
3939

@@ -46,7 +46,6 @@ const Crawlers = Object.freeze({
4646
[
4747
// AhrefsBot - https://ahrefs.com/robot
4848
// Amazonbot - https://developer.amazon.com/amazonbot
49-
// Applebot - http://apple.com/go/applebot
5049
// Bingbot - http://www.bing.com/bingbot.htm
5150
// CCBot - https://commoncrawl.org/faq
5251
// Dotbot - https://moz.com/help/moz-procedures/crawlers/dotbot
@@ -58,13 +57,17 @@ const Crawlers = Object.freeze({
5857
// OpenAI's SearchGPT - https://platform.openai.com/docs/bots
5958
// PerplexityBot - https://perplexity.ai/perplexitybot
6059
// SemrushBot - http://www.semrush.com/bot.html
61-
/((?:ahrefs|amazon|apple|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush)bot)\/([\w\.]+)/i,
60+
// SeznamBot - http://napoveda.seznam.cz/seznambot-intro
61+
/((?:ahrefs|amazon|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush|seznam)bot)\/([\w\.-]+)/i,
62+
63+
// Applebot - http://apple.com/go/applebot
64+
/(applebot(?:-extended)?)\/([\w\.]+)/i,
6265

6366
// Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001
6467
/(baiduspider)[-imagevdonsfcpr]{0,6}\/([\w\.]+)/i,
6568

6669
// ClaudeBot (Anthropic)
67-
/(claude(?:bot|-web))\/([\w\.]+)/i,
70+
/(claude(?:bot|-web)|anthropic-ai)\/?([\w\.]*)/i,
6871

6972
// Coc Coc Bot - https://help.coccoc.com/en/search-engine
7073
/(coccocbot-(?:image|web))\/([\w\.]+)/i,
@@ -91,8 +94,8 @@ const Crawlers = Object.freeze({
9194
// Yeti (Naver)
9295
/(yeti)\/([\w\.]+)/i,
9396

94-
// YisouSpider
95-
/(yisouspider)\/?([\w\.]*)/i
97+
// aiHitBot / Diffbot / Magpie-Crawler / Omgilibot / Webzio-Extended / Screaming Frog SEO Spider / Timpibot / VelenPublicWebCrawler / YisouSpider / YouBot
98+
/((?:aihit|diff|timpi|you)bot|omgili(?:bot)?|(?:magpie-|velenpublicweb)crawler|webzio-extended|(?:screaming frog seo |yisou)spider)\/?([\w\.]*)/i
9699
],
97100

98101
[NAME, VERSION, [TYPE, CRAWLER]],
@@ -101,13 +104,15 @@ const Crawlers = Object.freeze({
101104
// Google Bots
102105
/((?:adsbot|apis|mediapartners)-google(?:-mobile)?|google-?(?:other|cloudvertexbot|extended|safety))/i,
103106

107+
// AI2Bot - https://allenai.org/crawler
104108
// Bytespider
105109
// DataForSeoBot - https://dataforseo.com/dataforseo-bot
106110
// Huawei AspiegelBot / PetalBot https://aspiegel.com/petalbot
111+
// ImagesiftBot - https://imagesift.com/about
107112
// Qihoo 360Spider
108113
// TurnitinBot - https://www.turnitin.com/robot/crawlerinfo.html
109114
// Yahoo! Slurp - http://help.yahoo.com/help/us/ysearch/slurp
110-
/(360spider-?(?:image|video)?|bytespider|(?:aspiegel|dataforseo|petal|turnitin)bot|(?=yahoo! )slurp)/i
115+
/\b(360spider-?(?:image|video)?|bytespider|(?:ai2|aspiegel|dataforseo|imagesift|petal|turnitin)bot|teoma|(?=yahoo! )slurp)/i
111116
],
112117
[NAME, [TYPE, CRAWLER]]
113118
]
@@ -199,8 +204,10 @@ const ExtraDevices = Object.freeze({
199204

200205
const Emails = Object.freeze({
201206
browser : [
207+
[
202208
// Evolution / Kontact/KMail / [Microsoft/Mac] Outlook / Thunderbird
203-
[/(evolution|kmail2?|kontact|(?:microsoft |mac)outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, EMAIL]]
209+
/(airmail|bluemail|emclient|evolution|foxmail|kmail2?|kontact|(?:microsoft |mac)?outlook(?:-express)?|navermailapp|(?!chrom.+)sparrow|thunderbird|yahoo)(?:m.+ail; |[\/ ])([\w\.]+)/i
210+
], [NAME, VERSION, [TYPE, EMAIL]]
204211
]
205212
});
206213

@@ -238,8 +245,8 @@ const Fetchers = Object.freeze({
238245
],
239246
[NAME, VERSION, [TYPE, FETCHER]],
240247

241-
// Google Bots / Snapchat
242-
[/(feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
248+
// Google Bots / Cohere / Snapchat / Vercelbot
249+
[/(cohere-ai|vercelbot|feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
243250
[NAME, [TYPE, FETCHER]],
244251
]
245252
});
@@ -297,8 +304,6 @@ const MediaPlayers = Object.freeze({
297304
], [NAME, VERSION, [TYPE, MEDIAPLAYER]], [
298305

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

@@ -374,8 +379,8 @@ const MediaPlayers = Object.freeze({
374379

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

src/helpers/ua-parser-helpers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
1+
// Type definitions for Helpers submodule of UAParser.js v2.0.0
22
// Project: https://github.com/faisalman/ua-parser-js
33
// Definitions by: Faisal Salman <https://github.com/faisalman>
44

src/helpers/ua-parser-helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////
2-
/* Helpers for UAParser.js v2.0.0-rc.3
2+
/* Helpers for UAParser.js v2.0.0
33
https://github.com/faisalman/ua-parser-js
44
Author: Faisal Salman <f@faisalman.com>
55
AGPLv3 License */

src/helpers/ua-parser-helpers.mjs

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Source: /src/helpers/ua-parser-helpers.js
44

55
///////////////////////////////////////////////
6-
/* Helpers for UAParser.js v2.0.0-rc.3
6+
/* Helpers for UAParser.js v2.0.0
77
https://github.com/faisalman/ua-parser-js
88
Author: Faisal Salman <f@faisalman.com>
99
AGPLv3 License */
@@ -13,18 +13,22 @@
1313

1414
import { UAParser } from '../main/ua-parser.mjs';
1515
import { CPU, OS, Engine } from '../enums/ua-parser-enums.mjs';
16+
import { Bots } from '../extensions/ua-parser-extensions.mjs';
1617
import { isFromEU } from 'detect-europe-js';
1718
import { isFrozenUA } from 'ua-is-frozen';
1819
import { isStandalonePWA } from 'is-standalone-pwa';
1920

21+
const toResult = (value, head, ext) => typeof value === 'string' ? UAParser(value, head, ext) : value;
22+
2023
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
2124

22-
const isAppleSilicon = (res, useFeatureDetection) => {
25+
const isAppleSilicon = (resultOrUA) => {
26+
const res = toResult(resultOrUA);
2327
if (res.os.is(OS.MACOS)) {
2428
if (res.cpu.is(CPU.ARM)) {
2529
return true;
2630
}
27-
if (useFeatureDetection) {
31+
if (typeof resultOrUA !== 'string' && typeof window !== 'undefined') {
2832
try {
2933
const canvas = document.createElement('canvas');
3034
const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
@@ -41,16 +45,93 @@ const isAppleSilicon = (res, useFeatureDetection) => {
4145
return false;
4246
}
4347

44-
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'library'].includes(res.browser.type);
48+
const isAIBot = (resultOrUA) => [
49+
50+
// AI2
51+
'ai2bot',
52+
53+
// Amazon
54+
'amazonbot',
55+
56+
// Anthropic
57+
'anthropic-ai',
58+
'claude-web',
59+
'claudebot',
60+
61+
// Apple
62+
'applebot',
63+
'applebot-extended',
64+
65+
// ByteDance
66+
'bytespider',
67+
68+
// Common Crawl
69+
'ccbot',
70+
71+
// DataForSeo
72+
'dataforseobot',
73+
74+
// Diffbot
75+
'diffbot',
76+
77+
// Google
78+
'googleother',
79+
'googleother-image',
80+
'googleother-video',
81+
'google-extended',
82+
83+
// Hive AI
84+
'imagesiftbot',
85+
86+
// Huawei
87+
'petalbot',
88+
89+
// Meta
90+
'facebookbot',
91+
'meta-externalagent',
92+
93+
// OpenAI
94+
'gptbot',
95+
'oai-searchbot',
96+
97+
// Perplexity
98+
'perplexitybot',
99+
100+
// Timpi
101+
'timpibot',
102+
103+
// Velen.io
104+
'velenpublicwebcrawler',
105+
106+
// Webz.io
107+
'omgili',
108+
'omgilibot',
109+
'webzio-extended',
110+
111+
// You.com
112+
'youbot',
113+
114+
// Zyte
115+
'scrapy'
116+
117+
].includes(String(toResult(resultOrUA, Bots).browser.name).toLowerCase());
118+
119+
const isBot = (resultOrUA) => [
120+
'cli',
121+
'crawler',
122+
'fetcher',
123+
'library'
124+
].includes(toResult(resultOrUA, Bots).browser.type);
45125

46-
const isChromeFamily = (res) => res.engine.is(Engine.BLINK);
126+
const isChromeFamily = (resultOrUA) => toResult(resultOrUA).engine.is(Engine.BLINK);
47127

48128
const isElectron = () => !!(process?.versions?.hasOwnProperty('electron') || // node.js
49129
/ electron\//i.test(navigator?.userAgent)); // browser
50130

51131
export {
52132
getDeviceVendor,
53133
isAppleSilicon,
134+
isAIBot,
54135
isBot,
55136
isChromeFamily,
56137
isElectron,

src/main/ua-parser.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for UAParser.js v2.0.0-rc.3
1+
// Type definitions for UAParser.js v2.0.0
22
// Project: https://github.com/faisalman/ua-parser-js
33
// Definitions by: Faisal Salman <https://github.com/faisalman>
44

src/main/ua-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/////////////////////////////////////////////////////////////////////////////////
2-
/* UAParser.js v2.0.0-rc.3
2+
/* UAParser.js v2.0.0
33
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
44
AGPLv3 License *//*
55
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@@ -19,7 +19,7 @@
1919
// Constants
2020
/////////////
2121

22-
var LIBVERSION = '2.0.0-rc.3',
22+
var LIBVERSION = '2.0.0',
2323
EMPTY = '',
2424
UNKNOWN = '?',
2525
FUNC_TYPE = 'function',

0 commit comments

Comments
 (0)