diff options
author | Patrick <pmarschik@users.noreply.github.com> | 2018-09-20 03:19:24 +0200 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-09-19 18:19:24 -0700 |
commit | 2538eea1776e1d03d33465ad2001512caca93937 (patch) | |
tree | 021c417d5f31606fe50d7945872c4cda6cdc2060 /reader/scraper | |
parent | 1d335390c2ac7c0feeb94fce89eefdae9a1e7c17 (diff) |
Add the possibility to override default user agent for each feed
Diffstat (limited to 'reader/scraper')
-rw-r--r-- | reader/scraper/scraper.go | 6 |
1 files changed, 5 insertions, 1 deletions
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 |