{"id":31330893,"url":"https://github.com/samclarke/robots-parser","last_synced_at":"2025-09-26T00:09:56.940Z","repository":{"id":21217829,"uuid":"24531228","full_name":"samclarke/robots-parser","owner":"samclarke","description":"NodeJS robots.txt parser with support for wildcard (*) matching.","archived":false,"fork":false,"pushed_at":"2024-10-28T18:04:22.000Z","size":518,"stargazers_count":159,"open_issues_count":2,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-14T18:05:43.853Z","etag":null,"topics":["javascript","nodejs","rfc-9309","robots-exclusion-standard","robots-parser","robots-txt","user-agent"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samclarke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-27T12:25:33.000Z","updated_at":"2025-08-25T05:29:40.000Z","dependencies_parsed_at":"2024-06-20T06:50:34.630Z","dependency_job_id":"465f451c-e486-4565-9b82-b732a424f1c9","html_url":"https://github.com/samclarke/robots-parser","commit_stats":{"total_commits":79,"total_committers":8,"mean_commits":9.875,"dds":"0.12658227848101267","last_synced_commit":"dd032ec3da65e49bf2ba8d7224bd20883ef8ff34"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/samclarke/robots-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samclarke%2Frobots-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samclarke%2Frobots-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samclarke%2Frobots-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samclarke%2Frobots-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samclarke","download_url":"https://codeload.github.com/samclarke/robots-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samclarke%2Frobots-parser/sbom","scorecard":{"id":797260,"data":{"date":"2025-08-11","repo":{"name":"github.com/samclarke/robots-parser","commit":"9fc51876206a89c688e79dd9a9cf8aa7c1aebf58"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.9,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/25 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:27","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:28","Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/codeql-analysis.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/samclarke/robots-parser/test.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T09:22:04.418Z","repository_id":21217829,"created_at":"2025-08-23T09:22:04.419Z","updated_at":"2025-08-23T09:22:04.419Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277000045,"owners_count":25742834,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","nodejs","rfc-9309","robots-exclusion-standard","robots-parser","robots-txt","user-agent"],"created_at":"2025-09-26T00:07:15.277Z","updated_at":"2025-09-26T00:09:56.933Z","avatar_url":"https://github.com/samclarke.png","language":"JavaScript","readme":"# Robots Parser [![NPM downloads](https://img.shields.io/npm/dm/robots-parser)](https://www.npmjs.com/package/robots-parser) [![DeepScan grade](https://deepscan.io/api/teams/457/projects/16277/branches/344939/badge/grade.svg)](https://deepscan.io/dashboard#view=project\u0026tid=457\u0026pid=16277\u0026bid=344939) [![GitHub license](https://img.shields.io/github/license/samclarke/robots-parser.svg)](https://github.com/samclarke/robots-parser/blob/master/license.md) [![Coverage Status](https://coveralls.io/repos/github/samclarke/robots-parser/badge.svg?branch=master)](https://coveralls.io/github/samclarke/robots-parser?branch=master)\n\nA robots.txt parser which aims to be complaint with the [RFC 9309 specification](https://datatracker.ietf.org/doc/html/rfc9309).\n\nThe parser currently supports:\n\n-   User-agent:\n-   Allow:\n-   Disallow (with explicit mode support):\n-   Sitemap:\n-   Crawl-delay:\n-   Host:\n-   Paths with wildcards (\\*) and EOL matching ($)\n\n## Installation\n\nVia NPM:\n\n    npm install robots-parser\n\nor via Yarn:\n\n    yarn add robots-parser\n\n## Usage\n\n```js\nvar robotsParser = require('robots-parser');\n\nvar robots = robotsParser('http://www.example.com/robots.txt', [\n\t'User-agent: *',\n\t'Disallow: /dir/',\n\t'Disallow: /test.html',\n\t'Allow: /dir/test.html',\n\t'Allow: /test.html',\n\t'Crawl-delay: 1',\n\t'Sitemap: http://example.com/sitemap.xml',\n\t'Host: example.com'\n].join('\\n'));\n\nrobots.isAllowed('http://www.example.com/test.html', 'Sams-Bot/1.0'); // true\nrobots.isAllowed('http://www.example.com/dir/test.html', 'Sams-Bot/1.0'); // true\nrobots.isDisallowed('http://www.example.com/dir/test2.html', 'Sams-Bot/1.0'); // true\nrobots.isExplicitlyDisallowed('http://www.example.com/dir/test2.html', 'Sams-Bot/1.0'); // false\nrobots.getCrawlDelay('Sams-Bot/1.0'); // 1\nrobots.getSitemaps(); // ['http://example.com/sitemap.xml']\nrobots.getPreferredHost(); // example.com\n```\n\n### isAllowed(url, [ua])\n\n**boolean or undefined**\n\nReturns true if crawling the specified URL is allowed for the specified user-agent.\n\nThis will return `undefined` if the URL isn't valid for this robots.txt.\n\n### isDisallowed(url, [ua])\n\n**boolean or undefined**\n\nReturns true if crawling the specified URL is not allowed for the specified user-agent.\n\nThis will return `undefined` if the URL isn't valid for this robots.txt.\n\n### isExplicitlyDisallowed(url, ua)\n\n**boolean or undefined**\n\n\u003e [!CAUTION]\n\u003e This is not part of the robots.txt specification and should only be used with\n\u003e the websites owners permission.\n\u003e This method is only intended for special purposes where a user-agent shouldn't\n\u003e fallback to matching against global (*) rules.\n\u003e\n\u003e An example of this behaviour is [Google AdsBot](https://developers.google.com/search/docs/crawling-indexing/google-special-case-crawlers)\n\u003e which must be explicitly excluded. This is done with the website owners permission.\n\nReturns trues if explicitly disallowed for the specified user agent (User Agent wildcards are discarded).\n\nThis will return undefined if the URL is not valid for this robots.txt file.\n\n### getMatchingLineNumber(url, [ua])\n\n**number or undefined**\n\nReturns the line number of the matching directive for the specified URL and user-agent if any.\n\nLine numbers start at 1 and go up (1-based indexing).\n\nReturns -1 if there is no matching directive. If a rule is manually added without a lineNumber then this will return undefined for that rule.\n\n### getCrawlDelay([ua])\n\n**number or undefined**\n\nReturns the number of seconds the specified user-agent should wait between requests.\n\nReturns undefined if no crawl delay has been specified for this user-agent.\n\n### getSitemaps()\n\n**array**\n\nReturns an array of sitemap URLs specified by the `sitemap:` directive.\n\n### getPreferredHost()\n\n**string or null**\n\nReturns the preferred host name specified by the `host:` directive or null if there isn't one.\n\n# Changes\n\n### Version 3.0.1\n\n-   Fixed bug with `https:` URLs defaulting to port `80` instead of `443` if no port is specified.\n    Thanks to @dskvr for reporting\n\n    This affects comparing URLs with the default HTTPs port to URLs without it. \n    For example, comparing `https://example.com/` to `https://example.com:443/` or vice versa.\n\n    They should be treated as equivalent but weren't due to the incorrect port\n    being used for `https:`.\n\n### Version 3.0.0\n\n-   Changed to using global URL object instead of importing. \u0026ndash; Thanks to @brendankenny\n\n### Version 2.4.0:\n\n-   Added Typescript definitions  \n    \u0026ndash; Thanks to @danhab99 for creating\n-   Added SECURITY.md policy and CodeQL scanning\n\n### Version 2.3.0:\n\n-   Fixed bug where if the user-agent passed to `isAllowed()` / `isDisallowed()` is called \"constructor\" it would throw an error.\n-   Added support for relative URLs. This does not affect the default behavior so can safely be upgraded.\n\n    Relative matching is only allowed if both the robots.txt URL and the URLs being checked are relative.\n\n    For example:\n\n    ```js\n    var robots = robotsParser('/robots.txt', [\n        'User-agent: *',\n        'Disallow: /dir/',\n        'Disallow: /test.html',\n        'Allow: /dir/test.html',\n        'Allow: /test.html'\n    ].join('\\n'));\n\n    robots.isAllowed('/test.html', 'Sams-Bot/1.0'); // false\n    robots.isAllowed('/dir/test.html', 'Sams-Bot/1.0'); // true\n    robots.isDisallowed('/dir/test2.html', 'Sams-Bot/1.0'); // true\n    ```\n\n### Version 2.2.0:\n\n-   Fixed bug that with matching wildcard patterns with some URLs\n    \u0026ndash; Thanks to @ckylape for reporting and fixing\n-   Changed matching algorithm to match Google's implementation in google/robotstxt\n-   Changed order of precedence to match current spec\n\n### Version 2.1.1:\n\n-   Fix bug that could be used to causing rule checking to take a long time\n    \u0026ndash; Thanks to @andeanfog\n\n### Version 2.1.0:\n\n-   Removed use of punycode module API's as new URL API handles it\n-   Improved test coverage\n-   Added tests for percent encoded paths and improved support\n-   Added `getMatchingLineNumber()` method\n-   Fixed bug with comments on same line as directive\n\n### Version 2.0.0:\n\nThis release is not 100% backwards compatible as it now uses the new URL APIs which are not supported in Node \u003c 7.\n\n-   Update code to not use deprecated URL module API's.\n    \u0026ndash; Thanks to @kdzwinel\n\n### Version 1.0.2:\n\n-   Fixed error caused by invalid URLs missing the protocol.\n\n### Version 1.0.1:\n\n-   Fixed bug with the \"user-agent\" rule being treated as case sensitive.\n    \u0026ndash; Thanks to @brendonboshell\n-   Improved test coverage.\n    \u0026ndash; Thanks to @schornio\n\n### Version 1.0.0:\n\n-   Initial release.\n\n# License\n\n    The MIT License (MIT)\n\n    Copyright (c) 2014 Sam Clarke\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in\n    all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n    THE SOFTWARE.\n","funding_links":[],"categories":["\u003ca name=\"utils--user-agents\"\u003e\u003c/a\u003e🧰 Utils \u0026 User Agents"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamclarke%2Frobots-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamclarke%2Frobots-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamclarke%2Frobots-parser/lists"}