User Agent

This commit is contained in:
Sarah Jamie Lewis 2019-06-25 16:20:52 -07:00
parent 230cdac046
commit f2ef624070
1 changed files with 10 additions and 1 deletions

11
main.go
View File

@ -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)