add user-agent header

This commit is contained in:
Özgür Kesim 2024-06-06 14:18:33 +02:00
parent 73ceb1844b
commit f4ea425e9e
Signed by: oec
GPG Key ID: F136A7F922D018D7

View File

@ -31,7 +31,13 @@ func main() {
fromto = os.Args[2] + "." fromto = os.Args[2] + "."
} }
r, err := http.Get("http://" + fromto + BASE + url.QueryEscape(os.Args[1])) req, err := http.NewRequest("GET", "https://"+fromto+BASE+url.QueryEscape(os.Args[1]), nil)
if err != nil {
panic(err)
}
req.Header.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0")
r, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
println("error:", err.Error()) println("error:", err.Error())
return return