mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-12-07 13:49:47 +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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -691,6 +691,13 @@ class ArgParser {
|
|||
"path to SSH known hosts file for SOCKS5 over SSH proxy connection",
|
||||
type: "string",
|
||||
},
|
||||
|
||||
extraChromeArgs: {
|
||||
describe:
|
||||
"Extra arguments to pass directly to the Chrome instance (space-separated or multiple --extraChromeArgs)",
|
||||
type: "array",
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue