aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2022-02-10 14:31:41 -0700
committerJordan <me@jordan.im>2022-02-10 14:31:41 -0700
commit2dfdfd864285c5a12cd47e446fc8bdf244fd58f8 (patch)
treeac76c53062fa2b000b0af89dd0c52333875ca76e
parent6df82fabcc0053637fdc0f02e3669cd5fa21cb46 (diff)
downloadcrawl-2dfdfd864285c5a12cd47e446fc8bdf244fd58f8.tar.gz
crawl-2dfdfd864285c5a12cd47e446fc8bdf244fd58f8.zip
crawl: set User-Agent header to appear like Firefox on Windows
-rw-r--r--cmd/crawl/crawl.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/crawl/crawl.go b/cmd/crawl/crawl.go
index f2c4394..0be1572 100644
--- a/cmd/crawl/crawl.go
+++ b/cmd/crawl/crawl.go
@@ -248,7 +248,9 @@ func (c *crawlStats) Dump() {
var stats *crawlStats
func fetch(urlstr string) (*http.Response, error) {
- resp, err := httpClient.Get(urlstr)
+ req, _ := http.NewRequest("GET", urlstr, nil)
+ req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0")
+ resp, err := httpClient.Do(req)
if err == nil {
stats.Update(resp)
}