feature: add stealth mode, launch args, and init scripts to BrowserOptions
Add anti-bot-detection evasion support to reduce blocking by sites like archive.ph. Stealth mode is enabled by default for all browsers and applies common evasions: navigator.webdriver override, plugin/mimeType spoofing, window.chrome stub, and outerWidth/outerHeight fixes. For Chromium, --disable-blink-features=AutomationControlled is also added. New BrowserOptions fields: - Stealth *bool: toggle stealth presets (default true) - LaunchArgs []string: custom browser launch arguments - InitScripts []string: JavaScript injected before page scripts Closes #56 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,11 @@ var Flags = BrowserFlags{
|
||||
Usage: "If set, the browser will be visible, if not set, the browser will be headless",
|
||||
DefaultText: "false",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "no-stealth",
|
||||
Usage: "Disable stealth mode (anti-bot-detection evasions are enabled by default)",
|
||||
DefaultText: "false",
|
||||
},
|
||||
}
|
||||
|
||||
func FromCommand(ctx context.Context, cmd *cli.Command) (extractor.Browser, error) {
|
||||
@@ -74,5 +79,9 @@ func FromCommand(ctx context.Context, cmd *cli.Command) (extractor.Browser, erro
|
||||
opts.ShowBrowser = extractor.Bool(cmd.Bool("visible"))
|
||||
}
|
||||
|
||||
if cmd.IsSet("no-stealth") && cmd.Bool("no-stealth") {
|
||||
opts.Stealth = extractor.Bool(false)
|
||||
}
|
||||
|
||||
return extractor.NewBrowser(ctx, opts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user