Compare commits

...

2 Commits

Author SHA1 Message Date
Antoni Sawicki 7d9cec6297 add some anti crawler detection 2024-01-02 21:55:39 -08:00
Antoni Sawicki 43df501d97 add useragent override flag 2024-01-02 21:54:59 -08:00
1 changed files with 6 additions and 0 deletions

6
wrp.go
View File

@ -53,6 +53,7 @@ var (
fgeom = flag.String("g", "1152x600x216", "Geometry: width x height x colors, height can be 0 for unlimited")
htmFnam = flag.String("ui", "wrp.html", "HTML template file for the UI")
delay = flag.Duration("s", 2*time.Second, "Delay/sleep after page is rendered and before screenshot is taken")
userAgent = flag.String("ua", "", "override chrome user agent")
srv http.Server
actx, ctx context.Context
acncl, cncl context.CancelFunc
@ -562,7 +563,12 @@ func main() {
opts := append(chromedp.DefaultExecAllocatorOptions[:],
chromedp.Flag("headless", *headless),
chromedp.Flag("hide-scrollbars", false),
chromedp.Flag("enable-automation", false),
chromedp.Flag("disable-blink-features", "AutomationControlled"),
)
if *userAgent != "" {
opts = append(opts, chromedp.UserAgent(*userAgent))
}
actx, acncl = chromedp.NewExecAllocator(context.Background(), opts...)
defer acncl()
ctx, cncl = chromedp.NewContext(actx)