User Agent
This commit is contained in:
parent
230cdac046
commit
f2ef624070
11
main.go
11
main.go
|
@ -71,7 +71,16 @@ func download(url string, cachepath string) {
|
||||||
fmt.Printf("Fetching [%v]\n", url)
|
fmt.Printf("Fetching [%v]\n", url)
|
||||||
client := makeTorifiedClient()
|
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 {
|
if err == nil {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
body, _ := ioutil.ReadAll(resp.Body)
|
||||||
|
|
Loading…
Reference in New Issue