https://github.com/qubitproducts/funnelweb
Detect spiders/crawlers/bots by their User-Agent strings.
https://github.com/qubitproducts/funnelweb
ceh cmh implement
Last synced: 12 months ago
JSON representation
Detect spiders/crawlers/bots by their User-Agent strings.
- Host: GitHub
- URL: https://github.com/qubitproducts/funnelweb
- Owner: QubitProducts
- License: other
- Created: 2016-11-10T17:56:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T19:49:10.000Z (over 6 years ago)
- Last Synced: 2025-01-31T22:49:29.939Z (about 1 year ago)
- Topics: ceh, cmh, implement
- Language: JavaScript
- Homepage:
- Size: 82 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# funnelweb [](http://travis-ci.org/presentcompany/funnelweb) #
Tries to detect if a request is coming from a machine or a person using a
regular expression. Bot and browser `User-Agent` strings sourced from
[useragentstring.com](http://www.useragentstring.com/pages/useragentstring.php).
## Installation ##
``` bash
$ npm install funnelweb
```
## Usage ##
Funnelweb just takes a user agent string and returns "true" if it's probably a bot, or "false" otherwise.
``` javascript
var funnelweb = require('funnelweb')
funnelweb('GoogleBot') // true
funnelweb('Google Chrome') // false
```
If you pass it an HTTP request object, it'll read the User-Agent header and do
the same:
``` javascript
var funnelweb = require('funnelweb')
, http = require('http')
http.createServer(function(req, res) {
var response = funnelweb(req)
if (bot) {
res.end('you are a bot')
} else {
res.end('you are not a bot')
}
}).listen(3000)
```