Use referer on xpath getImage, apply printHTML to subscraper also (#661)

This commit is contained in:
bnkai
2020-07-10 01:42:06 +03:00
committed by GitHub
parent e9141b5dfc
commit 56210cf456
2 changed files with 23 additions and 6 deletions

View File

@@ -64,7 +64,14 @@ func getImage(url string) (*string, error) {
}
// assume is a URL for now
// set the host of the URL as the referer
if req.URL.Scheme != "" {
req.Header.Set("Referer", req.URL.Scheme+"://"+req.Host)
}
resp, err := client.Do(req)
if err != nil {
return nil, err
}