https://github.com/atomantic/is-ua-bot
🤖 tiny javascript module for checking user agents against a bot regex match (returns boolean)
https://github.com/atomantic/is-ua-bot
Last synced: about 1 year ago
JSON representation
🤖 tiny javascript module for checking user agents against a bot regex match (returns boolean)
- Host: GitHub
- URL: https://github.com/atomantic/is-ua-bot
- Owner: atomantic
- License: isc
- Created: 2017-06-03T18:17:30.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T22:39:52.000Z (almost 7 years ago)
- Last Synced: 2025-03-28T01:48:06.244Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 41 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# is-ua-bot
An improved user-agent parser to detect bots
[](https://travis-ci.org/atomantic/is-ua-bot)
[](https://www.npmjs.org/package/is-ua-bot)
[](https://www.npmjs.org/package/is-ua-bot)
[](https://www.npmjs.org/package/is-ua-bot)
## Installation
$ npm install is-ua-bot
## Usage
```js
const isBot = require('is-ua-bot')
// just for testing:
const assert = require('assert')
// identifies googlebot as bot (returns true)
assert(isBot('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'))
// Android Pixel is not a bot (returns false)
assert(!isBot('Android 7.1; Pixel Build/NDE63P)'))
```
## Tests
We have a set of Bot agents in `./test/data/bots.js` and a set of known non-bots in `./text/data/not-bots.js`. Please contribute!
Run tests
```bash
npm test
```
## Author
[](https://twitter.com/antic)
worthy of a tip?
âš¡ Lightning Bitcoin Tips Accepted https://tippin.me/@antic