From 68ae2a76deaa9cf2826b375b25d96fa4d14dd044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Os=C3=A9s?= Date: Wed, 14 Aug 2024 00:46:46 -0300 Subject: [PATCH] adding detection of MJ12Bot and SemrushBot into extension Crawlers including testing (#738) --- src/extensions/ua-parser-extensions.js | 4 +++- src/extensions/ua-parser-extensions.mjs | 4 +++- test/specs/browser-crawlers.json | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/extensions/ua-parser-extensions.js b/src/extensions/ua-parser-extensions.js index bd0ee40..f0d4a7b 100644 --- a/src/extensions/ua-parser-extensions.js +++ b/src/extensions/ua-parser-extensions.js @@ -46,7 +46,9 @@ const Crawlers = Object.freeze({ // DuckDuckBot - http://duckduckgo.com/duckduckbot.html // FacebookBot - https://developers.facebook.com/docs/sharing/bot/ // GPTBot - https://platform.openai.com/docs/gptbot - /((?:amazon|apple|bing|duckduck|facebook|gpt)bot)\/([\w\.]+)/i, + // MJ12bot - https://mj12bot.com/ + // SemrushBot - http://www.semrush.com/bot.html + /((?:amazon|apple|bing|duckduck|facebook|gpt|mj12|semrush)bot)\/([\w\.]+)/i, // Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001 /(baiduspider)[-imagevdonsfcpr]{0,6}\/([\w\.]+)/i, diff --git a/src/extensions/ua-parser-extensions.mjs b/src/extensions/ua-parser-extensions.mjs index 9bec890..1928890 100644 --- a/src/extensions/ua-parser-extensions.mjs +++ b/src/extensions/ua-parser-extensions.mjs @@ -48,7 +48,9 @@ const Crawlers = Object.freeze({ // DuckDuckBot - http://duckduckgo.com/duckduckbot.html // FacebookBot - https://developers.facebook.com/docs/sharing/bot/ // GPTBot - https://platform.openai.com/docs/gptbot - [/((?:amazon|apple|bing|duckduck|facebook|gpt)bot)\/([\w\.]+)/i], + // MJ12bot - https://mj12bot.com/ + // SemrushBot - http://www.semrush.com/bot.html + [/((?:amazon|apple|bing|duckduck|facebook|gpt|mj12|semrush)bot)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, CRAWLER]], // Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001 diff --git a/test/specs/browser-crawlers.json b/test/specs/browser-crawlers.json index 107ab24..b7e8169 100644 --- a/test/specs/browser-crawlers.json +++ b/test/specs/browser-crawlers.json @@ -79,6 +79,26 @@ "type" : "crawler" } }, + { + "desc" : "MJ12bot", + "ua" : "Mozilla/5.0 (compatible; MJ12bot/v1.4.8; http://mj12bot.com/)", + "expect" : + { + "name" : "MJ12bot", + "version" : "v1.4.8", + "type" : "crawler" + } + }, + { + "desc" : "SemrushBot", + "ua" : "Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html)", + "expect" : + { + "name" : "SemrushBot", + "version" : "7", + "type" : "crawler" + } + }, { "desc" : "Yahoo! Japan", "ua" : "Y!J-BRW/1.0 (https://www.yahoo-help.jp/app/answers/detail/p/595/a_id/42716)",