
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
fetch-politely
Advanced tools
Ensures polite outgoing HTTP requests that respects robots.txt and aren't made too close to each other
A library for ensuring polite outgoing HTTP requests that respect robots.txt and aren't made too close to each other
npm install fetch-politely --save
Simple:
var fetchInstance = new FetchPolitely(function (err, url, message) {
if (err) { return; }
// The URL has been cleared for fetching – the hostname isn't throttled and robots.txt doesn't ban it
}, {
// Robots.txt checking requires specification of a User Agent as Robots.txt can contain User Agent specific rules
// See http://en.wikipedia.org/wiki/User_agent for more info in format
userAgent: 'Your-Application-Name/your.app.version (http://example.com/optional/full/app/url)',
});
// When a slot has been reserved the callback sent in the constructor will be called
fetchInstance.requestSlot('http://foo.example.org/interesting/content/');
var fetchInstance = new FetchPolitely(callback, [options]);
function (err, url, message, [content]) {};, called for each succesful request slothostname. Defaults to 10 seconds.false.console.log()/.error().PoliteLookup.PoliteRobot.allowed().PoliteRobot to cache fetched robots.txt. Defaults to wrapped lru-cache.PoliteRobot.PoliteRobot.PoliteRobot and options.returnContent. The User Agent to use for HTTP requests.fetchInstance.requestSlot(url, [message], [options]);
FetchPolitely callback.true the URL will always be allowd and not be sent to the allowed function.false no more than one item of every url + message combination will be queued.The simplest of simple implementations for keeping track of throttled hosts and queued URL:s. Handles it all in-memory. Same interface can be used to build a database backend for this though.
A PostgreSQL + Knex-driven lookup that throttles hosts and queues URL using database tables.
Use by setting up the tables in pglookup.sql and include by setting the FetchPolitely options to:
{
lookup: FetchPolitely.PolitePGLookup,
lookupOptions: {
knex: knexInstance
}
}
Pull Requests are welcome if someone wants to pull out the Knex-dependency. Most projects where this has been used with Postgres has been using Knex so it got used here as well.
500 ms.2.5.false.npm test or to watch, install grunt-cli then do grunt watch
FAQs
Ensures polite outgoing HTTP requests that respects robots.txt and aren't made too close to each other
We found that fetch-politely demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.