Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
spider-detector
Advanced tools
Readme
A tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS
It might be useful when you have a single page app but want to deliver static pages for spiders.
npm install spider-detector // or `yarn install spider-detector`
const detector = require('spider-detector')
detector.isSpider('baiduspider') // return true
const detector = require('spider-detector')
const express = require('express')
const app = express()
app.use(detector.middleware())
app.get('/*', function(req, res) {
if (req.isSpider()) {
// do something else, i.E. send a static page
} else {
// send single page app
}
})
Well, I wanted one which does not use readFileSync
and comes with optional middleware. Furthermore some hackers do not classify Googlebot as a spider anymore which poses a problem sometimes, see next question.
Yep, Googlebot is able to deal with single page apps but this feature is pretty unstable. Especially under AngularJS when hash fragments are disabled with $locationProvider.html5Mode(true)
. That's why - against all odds - I have classified googlebot
as a spider in this module.
FAQs
A tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS
The npm package spider-detector receives a total of 2,038 weekly downloads. As such, spider-detector popularity was classified as popular.
We found that spider-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.