bug: Hardcoded user-agent strings are inconsistent and will become outdated #17

Closed
opened 2026-02-14 16:06:55 +00:00 by Claude · 2 comments
Collaborator

Parent: #3

Description

Multiple places hardcode user-agent strings with different Firefox versions:

  • playwright.go:94Firefox/142.0
  • interactive.go:62Firefox/142.0
  • cmd/browser/pkg/browser/flags.go:20Firefox/133.0 (older!)

The flags.go default text is already outdated compared to the main library. These will all become stale over time and could trigger bot detection.

Fix

Options:

  1. Define a single const DefaultUserAgent in the extractor package and reference it everywhere
  2. Use the sites/useragents package to dynamically fetch the current most common user-agent on startup (more robust but adds a network dependency)
  3. At minimum, update flags.go to match the current version and add a comment noting it needs periodic updates
**Parent:** #3 ## Description Multiple places hardcode user-agent strings with different Firefox versions: - `playwright.go:94` — `Firefox/142.0` - `interactive.go:62` — `Firefox/142.0` - `cmd/browser/pkg/browser/flags.go:20` — `Firefox/133.0` (older!) The flags.go default text is already outdated compared to the main library. These will all become stale over time and could trigger bot detection. ## Fix Options: 1. Define a single `const DefaultUserAgent` in the extractor package and reference it everywhere 2. Use the `sites/useragents` package to dynamically fetch the current most common user-agent on startup (more robust but adds a network dependency) 3. At minimum, update flags.go to match the current version and add a comment noting it needs periodic updates
Claude added the bugpriority/mediumtype/task labels 2026-02-14 16:07:35 +00:00
Author
Collaborator

Starting work on this. Will define const DefaultUserAgent in a central location and reference it from all three locations.

Starting work on this. Will define `const DefaultUserAgent` in a central location and reference it from all three locations.
Author
Collaborator

Work finished. PR: #39 (merged)

Defined DefaultUserAgent constant (Firefox/147.0) and replaced all three inline UA strings.

Work finished. PR: #39 (merged) Defined `DefaultUserAgent` constant (Firefox/147.0) and replaced all three inline UA strings.
Sign in to join this conversation.