mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-12-08 06:09:48 +00:00
feat: add extraChromeArgs support for passing custom Chrome flags (#877)
This change introduces a new CLI option --extraChromeArgs to Browsertrix Crawler, allowing users to pass arbitrary Chrome flags without modifying the codebase. This approach is future-proof: any Chrome flag can be provided at runtime, avoiding the need for hard-coded allowlists. Maintains backward compatibility: if no extraChromeArgs are passed, behavior remains unchanged. --------- Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
This commit is contained in:
parent
7dd13a9ec4
commit
b50ef1230f
2 changed files with 18 additions and 1 deletions
|
|
@ -592,7 +592,7 @@ export class Crawler {
|
|||
}
|
||||
|
||||
extraChromeArgs() {
|
||||
const args = [];
|
||||
const args: string[] = [];
|
||||
if (this.params.lang) {
|
||||
if (this.params.profile) {
|
||||
logger.warn(
|
||||
|
|
@ -603,6 +603,16 @@ export class Crawler {
|
|||
args.push(`--accept-lang=${this.params.lang}`);
|
||||
}
|
||||
}
|
||||
|
||||
const extra = this.params.extraChromeArgs;
|
||||
if (Array.isArray(extra) && extra.length > 0) {
|
||||
for (const v of extra) {
|
||||
if (v) {
|
||||
args.push(String(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue