eh
express-hawk
npm i express-hawk
eh

express-hawk

Identifies bots/crawlers

by Mr. Schneepflug

1.1.1 (see all)License:ISCTypeScript:Built-InCategories:Express Crawler
npm i express-hawk
Readme

express-hawk

Express middleware written in Typescript for identifying requests of bots/crawlers.

Build Status Coverage Status Greenkeeper badge

This library was inspired by es6-crawler-detect. The blacklist is taken from Crawler-Detect.

Installation

yarn add express-hawk

Note: Please keep in mind that this is a very basic check because the user-agent-header is tampered easily.

Usage

Use express-hawk as any other express-middleware.

import express, {Request, Response} from "express";
import {hawk} from "express-hawk";

const app = express();
app.use(hawk());

app.get("/", (req: Request, res: Response) => {
    // req.isBot is now either true or false
});

The middleware uses the blacklist user-agent.botlist. On each request it checks if the user-agent-header matches with an entry of this list. It sets req.isBot accordingly.

Tests

$ yarn install
$ yarn test

Downloads/wk

27

GitHub Stars

1

LAST COMMIT

1yr ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
1.1.1
latest
1yr ago
No tutorials found
Add a tutorial