From f4ea425e9e00d9e3b1efc2a0493c82c6e08866c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Thu, 6 Jun 2024 14:18:33 +0200 Subject: [PATCH] add user-agent header --- dict.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dict.go b/dict.go index 9721269..302fc62 100644 --- a/dict.go +++ b/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