Skip to content

Commit

Permalink
Merge tag 'tags/2.0.0' into pro-business
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Nov 21, 2024
2 parents abde14f + 38baf84 commit 74ab14e
Show file tree
Hide file tree
Showing 23 changed files with 589 additions and 73 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
- **`'ua-parser-js/helpers'`**: Provides utility methods to extend detection functionality:
- `getDeviceVendor()`: Guesses the device vendor based on its model name
- `isAppleSilicon()`: Detects Apple Silicon device properties
- `isBot()`: Checks if the browser is a bot
- `isAIBot()`: Checks if the user-agent is an AI bot
- `isBot()`: Checks if the user-agent is a bot
- `isChromeFamily()`: Checks if the browser is Chrome-based (uses Blink engine) — e.g., New Opera, New Edge, Vivaldi, Brave, Arc, etc.
- `isElectron()`: Detects if current window is running within Electron
- `isFromEU()`: Detects if current browser's timezone is from an EU country
Expand All @@ -64,6 +65,17 @@

---

## Version 2.0.0

- `ua-parser-js/extensions` submodule:
- Add new CLI: ELinks, HTTPie
- Add new crawler: AI2Bot, aiHitBot, anthropic-ai, Diffbot, ImagesiftBot, magpie-crawler, Omgilibot, Screaming Frog SEO Spider, Seznambot, Teoma, Timpibot, VelenPublicWebCrawler, Webzio-Extended, YouBot
- Add new email: Airmail, BlueMail, eMClient, NaverMailApp, Sparrow, Yahoo
- Add new fetcher: cohere-ai, Vercelbot
- Add new library: java, python-urllib, python-requests
- `ua-parser-js/helpers` submodule:
- Add new method `isAIBot()`: Checks if the user-agent is an AI bot

## Version 2.0.0-rc.3

- Add support for Headers object
Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<p align="center">
<a href="https://uaparser.dev"><img src="https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/uap-header.png"></a>
</p>
# UAParser.js PRO Business License

# UAParser.js
Thank you for choosing the UAParser.js PRO Business License.

Thank you for purchasing UAParser.js PRO Business License, if you haven't please order here: https://store.faisalman.com
Please be aware that using this package without a valid license purchase is strictly prohibited and constitutes a violation of applicable copyright laws.

An exception applies if the package is used solely as a part of a product developed by a valid license holder, in accordance with their license terms.

If you have not yet purchased a license, you may do so at https://store.faisalman.com.

# Download

Expand All @@ -16,8 +18,12 @@ npm install @ua-parser-js/pro-business

https://docs.uaparser.dev

```js
import { UAParser } from '@ua-parser-js/pro-business';
```

# License

UAParser.js PRO Business

Copyright (c) 2012-2024 Faisal Salman <<[email protected]>>
Copyright (c) 2023-2024 Faisal Salman <<[email protected]>>
4 changes: 2 additions & 2 deletions dist/ua-parser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ua-parser.pack.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "UAParser.js PRO Business",
"name": "@ua-parser-js/pro-business",
"version": "2.0.0-rc.3",
"version": "2.0.0",
"author": "Faisal Salman <[email protected]> (http://faisalman.com)",
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
"keywords": [
Expand Down Expand Up @@ -180,7 +180,8 @@
},
"./enums": {
"require": "./src/enums/ua-parser-enums.js",
"import": "./src/enums/ua-parser-enums.mjs"
"import": "./src/enums/ua-parser-enums.mjs",
"types": "./src/enums/ua-parser-enums.d.ts"
},
"./extensions": {
"require": "./src/extensions/ua-parser-extensions.js",
Expand Down
2 changes: 1 addition & 1 deletion src/enums/ua-parser-enums.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-rc.3
/* Enums for UAParser.js v2.0.0
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
UAParser.js PRO Business License */
Expand Down
2 changes: 1 addition & 1 deletion src/enums/ua-parser-enums.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Source: /src/enums/ua-parser-enums.js

///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-rc.3
/* Enums for UAParser.js v2.0.0
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
UAParser.js PRO Business License */
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ua-parser-extensions.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
// Type definitions for Helpers submodule of UAParser.js v2.0.0
// Project: https://github.com/faisalman/ua-parser-js
// Definitions by: Faisal Salman <https://github.com/faisalman>

Expand Down
37 changes: 21 additions & 16 deletions src/extensions/ua-parser-extensions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-rc.3
/* Extensions for UAParser.js v2.0.0
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
UAParser.js PRO Business License */
Expand Down Expand Up @@ -28,8 +28,8 @@ const LIBRARY = 'library';

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

Expand All @@ -42,7 +42,6 @@ const Crawlers = Object.freeze({
[
// AhrefsBot - https://ahrefs.com/robot
// Amazonbot - https://developer.amazon.com/amazonbot
// Applebot - http://apple.com/go/applebot
// Bingbot - http://www.bing.com/bingbot.htm
// CCBot - https://commoncrawl.org/faq
// Dotbot - https://moz.com/help/moz-procedures/crawlers/dotbot
Expand All @@ -54,13 +53,17 @@ const Crawlers = Object.freeze({
// OpenAI's SearchGPT - https://platform.openai.com/docs/bots
// PerplexityBot - https://perplexity.ai/perplexitybot
// SemrushBot - http://www.semrush.com/bot.html
/((?:ahrefs|amazon|apple|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush)bot)\/([\w\.]+)/i,
// SeznamBot - http://napoveda.seznam.cz/seznambot-intro
/((?:ahrefs|amazon|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush|seznam)bot)\/([\w\.-]+)/i,

// Applebot - http://apple.com/go/applebot
/(applebot(?:-extended)?)\/([\w\.]+)/i,

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

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

// Coc Coc Bot - https://help.coccoc.com/en/search-engine
/(coccocbot-(?:image|web))\/([\w\.]+)/i,
Expand All @@ -87,8 +90,8 @@ const Crawlers = Object.freeze({
// Yeti (Naver)
/(yeti)\/([\w\.]+)/i,

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

[NAME, VERSION, [TYPE, CRAWLER]],
Expand All @@ -97,13 +100,15 @@ const Crawlers = Object.freeze({
// Google Bots
/((?:adsbot|apis|mediapartners)-google(?:-mobile)?|google-?(?:other|cloudvertexbot|extended|safety))/i,

// AI2Bot - https://allenai.org/crawler
// Bytespider
// DataForSeoBot - https://dataforseo.com/dataforseo-bot
// Huawei AspiegelBot / PetalBot https://aspiegel.com/petalbot
// ImagesiftBot - https://imagesift.com/about
// Qihoo 360Spider
// TurnitinBot - https://www.turnitin.com/robot/crawlerinfo.html
// Yahoo! Slurp - http://help.yahoo.com/help/us/ysearch/slurp
/(360spider-?(?:image|video)?|bytespider|(?:aspiegel|dataforseo|petal|turnitin)bot|(?=yahoo! )slurp)/i
/\b(360spider-?(?:image|video)?|bytespider|(?:ai2|aspiegel|dataforseo|imagesift|petal|turnitin)bot|teoma|(?=yahoo! )slurp)/i
],
[NAME, [TYPE, CRAWLER]]
]
Expand Down Expand Up @@ -195,8 +200,10 @@ const ExtraDevices = Object.freeze({

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

Expand Down Expand Up @@ -234,8 +241,8 @@ const Fetchers = Object.freeze({
],
[NAME, VERSION, [TYPE, FETCHER]],

// Google Bots / Snapchat
[/(feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
// Google Bots / Cohere / Snapchat / Vercelbot
[/(cohere-ai|vercelbot|feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
[NAME, [TYPE, FETCHER]],
]
});
Expand Down Expand Up @@ -293,8 +300,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 +375,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
37 changes: 21 additions & 16 deletions src/extensions/ua-parser-extensions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Source: /src/extensions/ua-parser-extensions.js

///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-rc.3
/* Extensions for UAParser.js v2.0.0
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
UAParser.js PRO Business License */
Expand Down Expand Up @@ -32,8 +32,8 @@ const LIBRARY = 'library';

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

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

// Applebot - http://apple.com/go/applebot
/(applebot(?:-extended)?)\/([\w\.]+)/i,

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

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

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

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

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

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

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

Expand Down Expand Up @@ -238,8 +245,8 @@ const Fetchers = Object.freeze({
],
[NAME, VERSION, [TYPE, FETCHER]],

// Google Bots / Snapchat
[/(feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
// Google Bots / Cohere / Snapchat / Vercelbot
[/(cohere-ai|vercelbot|feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
[NAME, [TYPE, FETCHER]],
]
});
Expand Down Expand Up @@ -297,8 +304,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 @@ -374,8 +379,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
10 changes: 6 additions & 4 deletions src/helpers/ua-parser-helpers.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
// Type definitions for Helpers submodule of UAParser.js v2.0.0
// Project: https://github.com/faisalman/ua-parser-js
// Definitions by: Faisal Salman <https://github.com/faisalman>

import { IResult } from "../main/ua-parser";

declare function getDeviceVendor(model: string): string | undefined;
declare function isAppleSilicon(res: IResult, useFeatureDetection?: boolean): boolean;
declare function isBot(res: IResult): boolean;
declare function isChromeFamily(res: IResult): boolean;
declare function isAppleSilicon(resultOrUA: IResult | string): boolean;
declare function isAIBot(resultOrUA: IResult | string): boolean;
declare function isBot(resultOrUA: IResult | string): boolean;
declare function isChromeFamily(resultOrUA: IResult | string): boolean;
declare function isElectron(): boolean;
declare function isFromEU(): boolean;
declare function isFrozenUA(ua: string): boolean;
Expand All @@ -16,6 +17,7 @@ declare function isStandalonePWA(): boolean;
export {
getDeviceVendor,
isAppleSilicon,
isAIBot,
isBot,
isChromeFamily,
isElectron,
Expand Down
Loading

0 comments on commit 74ab14e

Please sign in to comment.