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: 4 months 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-19T04:31:42.000Z (over 4 years ago)
- Last Synced: 2025-01-02T00:06:25.626Z (4 months 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
[](https://www.npmjs.com/package/is-duckduck)
[](https://travis-ci.org/roccomuso/is-duckduck)

[](https://david-dm.org/roccomuso/is-duckduck)
[](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)