From 2538eea1776e1d03d33465ad2001512caca93937 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 20 Sep 2018 03:19:24 +0200 Subject: Add the possibility to override default user agent for each feed --- reader/scraper/scraper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'reader/scraper') diff --git a/reader/scraper/scraper.go b/reader/scraper/scraper.go index d2cccdb..7aa7084 100644 --- a/reader/scraper/scraper.go +++ b/reader/scraper/scraper.go @@ -19,8 +19,12 @@ import ( ) // Fetch downloads a web page a returns relevant contents. -func Fetch(websiteURL, rules string) (string, error) { +func Fetch(websiteURL, rules, userAgent string) (string, error) { clt := client.New(websiteURL) + if userAgent != "" { + clt.WithUserAgent(userAgent) + } + response, err := clt.Get() if err != nil { return "", err -- cgit v1.2.3