Skip to content

Commit 5e3a1f9

Browse files
committed
feat: add extraChromeArgs support for passing custom Chrome flags
1 parent f7a080f commit 5e3a1f9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/crawler.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ export class Crawler {
594594
}
595595

596596
extraChromeArgs() {
597-
const args = [];
597+
const args: string[] = [];
598598
if (this.params.lang) {
599599
if (this.params.profile) {
600600
logger.warn(
@@ -605,6 +605,16 @@ export class Crawler {
605605
args.push(`--accept-lang=${this.params.lang}`);
606606
}
607607
}
608+
609+
const extra = this.params.extraChromeArgs;
610+
if (Array.isArray(extra) && extra.length > 0) {
611+
for (const v of extra) {
612+
if (v !== undefined && v !== null && v !== "") {
613+
args.push(String(v));
614+
}
615+
}
616+
}
617+
608618
return args;
609619
}
610620

src/util/argParser.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,13 @@ class ArgParser {
683683
"path to SSH known hosts file for SOCKS5 over SSH proxy connection",
684684
type: "string",
685685
},
686+
687+
extraChromeArgs: {
688+
describe:
689+
"Extra arguments to pass directly to the Chrome instance (space-separated or multiple --extraChromeArgs)",
690+
type: "array",
691+
default: [],
692+
},
686693
});
687694
}
688695

0 commit comments

Comments
 (0)