feat: switch stealth Chromium default channel to consumer Chrome
Playwright's bundled Chromium has a distinct build fingerprint (build ID, uniform WebGL/codec lists, HeadlessChrome residue) that anti-bot services increasingly flag. Driving a system-installed Google Chrome via Playwright's channel option sheds that signal and aligns sec-ch-ua with UA more cleanly. Changes: - Add BrowserOptions.Channel string field (chrome, chrome-beta, chromium, msedge; empty = default). - When stealth+headless+Chromium and Channel is empty, default to "chrome" (was "chromium"). Explicit Channel values always win, so callers can opt back to "chromium" or pick another channel. - Merge Channel in mergeOptions. - Expose --channel/--ch flag on cmd/browser for A/B fingerprint testing. Callers must have the chosen browser installed on the host (e.g. `playwright install chrome`). Firefox and WebKit paths are untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,11 @@ var Flags = BrowserFlags{
|
||||
Usage: "Disable stealth mode (anti-bot-detection evasions are enabled by default)",
|
||||
DefaultText: "false",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "channel",
|
||||
Usage: "Chromium channel to launch (chrome, chrome-beta, chromium, msedge). Only applies when --browser=chromium. Empty = stealth default (chrome).",
|
||||
Aliases: []string{"ch"},
|
||||
},
|
||||
}
|
||||
|
||||
func FromCommand(ctx context.Context, cmd *cli.Command) (extractor.Browser, error) {
|
||||
@@ -83,5 +88,9 @@ func FromCommand(ctx context.Context, cmd *cli.Command) (extractor.Browser, erro
|
||||
opts.Stealth = extractor.Bool(false)
|
||||
}
|
||||
|
||||
if ch := cmd.String("channel"); ch != "" {
|
||||
opts.Channel = ch
|
||||
}
|
||||
|
||||
return extractor.NewBrowser(ctx, opts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user