add user-agent header
This commit is contained in:
parent
73ceb1844b
commit
f4ea425e9e
8
dict.go
8
dict.go
@ -31,7 +31,13 @@ func main() {
|
||||
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 {
|
||||
println("error:", err.Error())
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user