Add headers to default/youtube
continuous-integration/drone/push Build is passing Details

master
Tyler 3 years ago
parent 3cecfb8c8b
commit 9ae4527143

@ -78,6 +78,8 @@ func (api *LinkInfoApi) DefaultLinkHandler(link string) (*LinkInfo, error) {
return nil, err
}
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
if api.UserAgent != "" {
req.Header.Set("User-Agent", api.UserAgent)
}
@ -155,6 +157,8 @@ func (api *LinkInfoApi) detectContentType(link, defaultType string) string {
return defaultType
}
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
if api.UserAgent != "" {
req.Header.Set("User-Agent", api.UserAgent)
}
@ -195,6 +199,8 @@ func (api *LinkInfoApi) retrieveHtmlLinkTitle(i *LinkInfo, link string) error {
return err
}
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
if api.UserAgent != "" {
req.Header.Set("User-Agent", api.UserAgent)
}

@ -87,6 +87,9 @@ func (i *YoutubeInfoApi) Handler(link string) (*LinkInfo, error) {
return nil, err
}
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
req.Header.Set("User-Agent", "LinkInfo/1.0")
res, err := i.api.Client.Do(req)
if err != nil {

Loading…
Cancel
Save