Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Last active March 20, 2019 05:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save abhirockzz/0e764c9cfceb820093a1893911622101 to your computer and use it in GitHub Desktop.
...
giphyResp, err := http.Get("http://api.giphy.com/v1/gifs/random?tag=" + giphyTag + "&api_key=" + apiKey)
if err != nil {
fmt.Println("giphy did not respond", err)
return
}
resp, err := ioutil.ReadAll(giphyResp.Body)
if err != nil {
fmt.Println("could not read giphy resp", err)
return
}
var gr GiphyResponse
json.Unmarshal(resp, &gr)
title := gr.Data.Title
url := gr.Data.Images.Downsized.URL
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment