aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Kuznetsov <evgeny@kuznetsov.md>2022-03-21 18:51:12 +0300
committerEvgeny Kuznetsov <evgeny@kuznetsov.md>2022-03-21 18:51:12 +0300
commit400094b2d321e22a261e64246ec1134f961cc0e8 (patch)
tree115e8a92c11a2896ec50df3acf08cfa8e3dfda46
parent51cf63a33f23ab9e4507ed440c57c44f9714ede3 (diff)
downloadradiorus-rss-400094b2d321e22a261e64246ec1134f961cc0e8.tar.gz
radiorus-rss-400094b2d321e22a261e64246ec1134f961cc0e8.zip
spoof user-agent
-rw-r--r--main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.go b/main.go
index b7f3d04..124a142 100644
--- a/main.go
+++ b/main.go
@@ -287,7 +287,10 @@ func addText(arr []string, str string) []string {
}
func getPage(pageUrl string) []byte {
- res, err := http.Get(pageUrl)
+ client := &http.Client{}
+ req, err := http.NewRequest("GET", pageUrl, nil)
+ req.Header.Add("User-Agent", `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.27 Safari/537.36`)
+ res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}