Closed ivanmlaborda closed 2 months ago
we have a ua-parser
context in this package... wouldn't it make sense to keep this checkUserAgentIsBot
under a common folder, since they both are related to user agents? 🤔
https://github.com/SUI-Components/sui/blob/master/packages/sui-js/src/ua-parser/index.js
we have a
ua-parser
context in this package... wouldn't it make sense to keep thischeckUserAgentIsBot
under a common folder, since they both are related to user agents? 🤔https://github.com/SUI-Components/sui/blob/master/packages/sui-js/src/ua-parser/index.js
Before sending this PR, I was thinking about it and didn't see a clear relation between UA parsing and business logic to define legitimate bots. I don't know.
Check user agents to detect bots
Description
checkLegitimateCrawler method can detect if the passed user agent is one of the following legitimate bots [
'googlebot', 'google-structured-data-testing-tool', 'bingbot', 'linkedinbot', 'mediapartners-google', 'debugbear' ]
Example
const BOT_USER_AGENT = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
checkUserAgentIsBot(BOT_USER_AGENT) // returns true