Add headers to default/youtube
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3cecfb8c8b
commit
9ae4527143
|
@ -78,6 +78,8 @@ func (api *LinkInfoApi) DefaultLinkHandler(link string) (*LinkInfo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
|
||||||
if api.UserAgent != "" {
|
if api.UserAgent != "" {
|
||||||
req.Header.Set("User-Agent", api.UserAgent)
|
req.Header.Set("User-Agent", api.UserAgent)
|
||||||
}
|
}
|
||||||
|
@ -155,6 +157,8 @@ func (api *LinkInfoApi) detectContentType(link, defaultType string) string {
|
||||||
return defaultType
|
return defaultType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
|
||||||
if api.UserAgent != "" {
|
if api.UserAgent != "" {
|
||||||
req.Header.Set("User-Agent", api.UserAgent)
|
req.Header.Set("User-Agent", api.UserAgent)
|
||||||
}
|
}
|
||||||
|
@ -195,6 +199,8 @@ func (api *LinkInfoApi) retrieveHtmlLinkTitle(i *LinkInfo, link string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
|
||||||
|
|
||||||
if api.UserAgent != "" {
|
if api.UserAgent != "" {
|
||||||
req.Header.Set("User-Agent", api.UserAgent)
|
req.Header.Set("User-Agent", api.UserAgent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,9 @@ func (i *YoutubeInfoApi) Handler(link string) (*LinkInfo, error) {
|
||||||
return nil, err
|
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)
|
res, err := i.api.Client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue