Skip to content

Commit

Permalink
add useragent override flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tenox7 committed Jan 3, 2024
1 parent 85d64a3 commit 43df501
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wrp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -563,6 +564,9 @@ func main() {
chromedp.Flag("headless", *headless),
chromedp.Flag("hide-scrollbars", false),
)
if *userAgent != "" {
opts = append(opts, chromedp.UserAgent(*userAgent))
}
actx, acncl = chromedp.NewExecAllocator(context.Background(), opts...)
defer acncl()
ctx, cncl = chromedp.NewContext(actx)
Expand Down

0 comments on commit 43df501

Please sign in to comment.