You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
473 B
30 lines
473 B
package codeforcesbot
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"net/http"
|
|
)
|
|
|
|
type KittyRequest struct {
|
|
Breeds []string
|
|
Id string
|
|
Url string
|
|
Width int
|
|
Height int
|
|
}
|
|
|
|
func getKitty() string{
|
|
response, err := http.Get("https://api.thecatapi.com/v1/images/search")
|
|
if err == nil {
|
|
body, _ := ioutil.ReadAll(response.Body)
|
|
//fmt.Printf(string(body))
|
|
var ret [5]KittyRequest
|
|
json.Unmarshal(body, &ret)
|
|
fmt.Println(ret)
|
|
return ret[0].Url
|
|
}
|
|
return ""
|
|
}
|