From f2ef62407056c3a87d4ebfc1582fa636e038b4c4 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 25 Jun 2019 16:20:52 -0700 Subject: [PATCH] User Agent --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index ebc4418..3ff8dff 100644 --- a/main.go +++ b/main.go @@ -71,7 +71,16 @@ func download(url string, cachepath string) { fmt.Printf("Fetching [%v]\n", url) client := makeTorifiedClient() - resp, err := client.Get(url) + req, err := http.NewRequest("GET", url, nil) + if err != nil { + log.Fatalln(err) + } + + // Set User Agent to be Tor Browser (it likely won't be hard for a site to determine these requests are partially automated, but a little more obfuscation is never a bad idea) + req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0") + + resp, err := client.Do(req) + if err == nil { defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body)