robots-parser
Advanced tools
Changelog
Version 3.0.1
Fixed bug with https:
URLs defaulting to port 80
instead of 443
if no port is specified.
Thanks to @dskvr for reporting
This affects comparing URLs with the default HTTPs port to URLs without it.
For example, comparing https://example.com/
to https://example.com:443/
or vice versa.
They should be treated as equivalent but weren't due to the incorrect port
being used for https:
.
Changelog
Version 3.0.0
Changelog
Version 2.4.0:
Changelog
Version 2.3.0:
Fixed bug where if the user-agent passed to isAllowed()
/ isDisallowed()
is called "constructor" it would throw an error.
Added support for relative URLs. This does not affect the default behavior so can safely be upgraded.
Relative matching is only allowed if both the robots.txt URL and the URLs being checked are relative.
For example:
var robots = robotsParser('/robots.txt', [
'User-agent: *',
'Disallow: /dir/',
'Disallow: /test.html',
'Allow: /dir/test.html',
'Allow: /test.html'
].join('\n'));
robots.isAllowed('/test.html', 'Sams-Bot/1.0'); // false
robots.isAllowed('/dir/test.html', 'Sams-Bot/1.0'); // true
robots.isDisallowed('/dir/test2.html', 'Sams-Bot/1.0'); // true
Changelog
Version 2.2.0:
Changelog
Version 2.1.1:
Changelog
Version 2.1.0:
getMatchingLineNumber()
methodChangelog
Version 2.0.0:
This release is not 100% backwards compatible as it now uses the new URL APIs which are not supported in Node < 7.