Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roccomuso/is-duckduck
Verify that a request is from DuckDuckBot, the Web crawler for DuckDuckGo
https://github.com/roccomuso/is-duckduck
crawler duckduck duckduckbot duckduckgo ip js nodejs verify web
Last synced: 25 days ago
JSON representation
Verify that a request is from DuckDuckBot, the Web crawler for DuckDuckGo
- Host: GitHub
- URL: https://github.com/roccomuso/is-duckduck
- Owner: roccomuso
- License: mit
- Created: 2018-04-28T14:33:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-19T04:31:42.000Z (about 4 years ago)
- Last Synced: 2025-01-02T00:06:25.626Z (about 1 month ago)
- Topics: crawler, duckduck, duckduckbot, duckduckgo, ip, js, nodejs, verify, web
- Language: JavaScript
- Size: 7.81 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# is-duckduck
[![NPM Version](https://img.shields.io/npm/v/is-duckduck.svg)](https://www.npmjs.com/package/is-duckduck)
[![Build Status](https://travis-ci.org/roccomuso/is-duckduck.svg?branch=master)](https://travis-ci.org/roccomuso/is-duckduck)
![node](https://img.shields.io/node/v/is-duckduck.svg)
[![Dependency Status](https://david-dm.org/roccomuso/is-duckduck.png)](https://david-dm.org/roccomuso/is-duckduck)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)> Verify that a request is from DuckDuckBot, the Web crawler for DuckDuckGo
This library implements DuckDuckGo's own verification steps [outlined here](https://help.duckduckgo.com/duckduckgo-help-pages/results/duckduckbot/).
## Install
`npm install --save is-duckduck`
## Example
```javascript
const isDuckDuck = require('is-duckduck')let ip = '72.94.249.34'
isDuckDuck(ip).then((outcome) => {
if (outcome) {
// it's duckduck.
}
}).catch(console.error)
```### Example with express
```javascript
app.enable('trust proxy')app.use((req, res, next) => {
let ip = req.ip || req.connection.remoteAddress
isDuckDuck(ip).then(outcome => {
if (outcome) {
res.status(404).text('Nothing to scan') // block duckduck crawler
} else {
next() // it's a user
}
})
})
```## Tests
`npm test`
## License
MIT
## Author
Rocco Musolino [@roccomuso](https://twitter.com/roccomuso)