Skip to content

Commit

Permalink
Merge pull request #261 from quantcdn/feat/specify-ua-crawl
Browse files Browse the repository at this point in the history
Feat: User-agent support for crawl.
  • Loading branch information
steveworley authored Jun 27, 2024
2 parents 73f4cf9 + cfd2d65 commit 26a18a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/commands/crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ command.builder = {
type: 'boolean',
default: false,
},
'user-agent': {
describe: 'The user-agent to send with the request',
type: 'string',
default: 'Quant (+http://api.quantcdn.io)',
},
};

/**
Expand Down Expand Up @@ -151,6 +156,9 @@ command.handler = async function(argv) {
crawl.maxConcurrency = argv.concurrency;
crawl.respectRobotsTxt = argv.robots;
crawl.acceptCookies = argv.cookies;
crawl.customHeaders = {
'User-Agent': argv['user-agent'],
};

const quant = client(config);

Expand Down

0 comments on commit 26a18a3

Please sign in to comment.