random user agents
This commit is contained in:
parent
4e8ca3192f
commit
8e5f8c8a10
8 changed files with 418 additions and 12 deletions
13
images.go
13
images.go
|
@ -70,7 +70,18 @@ func fetchImageResults(query string, safe, lang string, page int) ([]ImageSearch
|
|||
return nil, fmt.Errorf("creating request: %v", err)
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36")
|
||||
// User Agent generation
|
||||
ImageUserAgent, err := GetUserAgent("Image-Search")
|
||||
if err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if debugMode {
|
||||
fmt.Println("Generated User Agent (images):", ImageUserAgent)
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", ImageUserAgent)
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue