Skip to content

Commit

Permalink
add user-agent bot in ParseMetaForURL
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitoyama committed Sep 3, 2023
1 parent 8a2db60 commit ba48c82
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion service/ogp/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ func ParseMetaForURL(url *url.URL) (*opengraph.OpenGraph, *DefaultPageMeta, erro
client := http.Client{
Timeout: 5 * time.Second,
}
resp, err := client.Get(url.String())

req, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
return nil, nil, ErrNetwork
}

req.Header.Add("user-agent", `bot`)

resp, err := client.Do(req)
if err != nil {
return nil, nil, ErrNetwork
}
Expand Down

0 comments on commit ba48c82

Please sign in to comment.