enhance: thread-safe CookieJar, SameSite cookie attr, dynamic Google countries
- Wrap staticCookieJar in struct with sync.RWMutex for thread safety - Add SameSite field to Cookie struct with Strict/Lax/None constants - Update Playwright cookie conversion functions for SameSite - Replace hardcoded 4-country switch with dynamic country code generation Closes #20, #22, #23 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/go-extractor"
|
||||
)
|
||||
@@ -65,24 +66,7 @@ func (c Config) Search(ctx context.Context, b extractor.Browser, query string) (
|
||||
}
|
||||
|
||||
if c.Country != "" {
|
||||
country := ""
|
||||
switch c.Country {
|
||||
case "us":
|
||||
country = "countryUS"
|
||||
|
||||
case "uk":
|
||||
country = "countryUK"
|
||||
|
||||
case "au":
|
||||
country = "countryAU"
|
||||
|
||||
case "ca":
|
||||
country = "countryCA"
|
||||
}
|
||||
|
||||
if country != "" {
|
||||
vals.Set("cr", country)
|
||||
}
|
||||
vals.Set("cr", "country"+strings.ToUpper(c.Country))
|
||||
}
|
||||
|
||||
u.RawQuery = vals.Encode()
|
||||
|
||||
Reference in New Issue
Block a user