{"id":15650575,"url":"https://github.com/binarykitchen/spider-detector","last_synced_at":"2025-03-03T18:23:42.448Z","repository":{"id":25310174,"uuid":"28736832","full_name":"binarykitchen/spider-detector","owner":"binarykitchen","description":"A tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS","archived":false,"fork":false,"pushed_at":"2024-08-28T22:23:13.000Z","size":72,"stargazers_count":36,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-17T16:16:01.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binarykitchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-03T06:26:09.000Z","updated_at":"2025-02-10T08:36:45.000Z","dependencies_parsed_at":"2024-06-18T15:37:19.770Z","dependency_job_id":"95b3286a-4d28-478e-9140-5fb5772b3876","html_url":"https://github.com/binarykitchen/spider-detector","commit_stats":{"total_commits":32,"total_committers":8,"mean_commits":4.0,"dds":0.3125,"last_synced_commit":"742cd530a145737ce9b744b2b4f5e4cd8cff14ed"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fspider-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fspider-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fspider-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fspider-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binarykitchen","download_url":"https://codeload.github.com/binarykitchen/spider-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240521047,"owners_count":19814694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:35:08.560Z","updated_at":"2025-02-24T17:12:29.021Z","avatar_url":"https://github.com/binarykitchen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spider-detector\n\n[![Build Status](https://travis-ci.org/binarykitchen/spider-detector.svg?branch=master)](https://travis-ci.org/binarykitchen/spider-detector) [![npm version](https://badge.fury.io/js/spider-detector.svg)](https://badge.fury.io/js/spider-detector)\n\nA tiny node module to detect spiders/crawlers quickly and comes with optional middleware for ExpressJS\n\nIt might be useful when you have a single page app but want to deliver static pages for spiders.\n\n## Install\n\n```\nnpm install spider-detector // or `yarn install spider-detector`\n```\n\n## Direct Example\n\n```js\nconst detector = require('spider-detector')\ndetector.isSpider('baiduspider') // return true\n```\n\n## ExpressJS example\n\n```js\nconst detector = require('spider-detector')\nconst express = require('express')\nconst app = express()\n\napp.use(detector.middleware())\n\napp.get('/*', function(req, res) {\n  if (req.isSpider()) {\n    // do something else, i.E. send a static page\n  } else {\n    // send single page app\n  }\n})\n```\n\n## Why? There are already modules out there\n\nWell, 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.\n\n## What about Googlebot?\n\nYep, 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarykitchen%2Fspider-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarykitchen%2Fspider-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarykitchen%2Fspider-detector/lists"}