From 4b7149b66b6b2a0f9e6c57724a0abf60910c74b9 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 27 Mar 2019 13:56:24 +0000 Subject: [PATCH] fix name error --- module/apis/google/google.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/module/apis/google/google.go b/module/apis/google/google.go index 2002f4e..e1f0e10 100644 --- a/module/apis/google/google.go +++ b/module/apis/google/google.go @@ -9,7 +9,6 @@ import ( "strings" "git.trj.tw/golang/mtfosbot/module/apis" - "git.trj.tw/golang/mtfosbot/module/utils" jsoniter "github.com/json-iterator/go" "git.trj.tw/golang/mtfosbot/module/config" @@ -52,11 +51,11 @@ func getHeaders(token ...interface{}) map[string]string { // ChannelItem - type ChannelItem struct { ID string `json:"id"` - Sinppet ChannelSinppet `json:"sinppet"` + Snippet ChannelSnippet `json:"snippet"` } -// ChannelSinppet - -type ChannelSinppet struct { +// ChannelSnippet - +type ChannelSnippet struct { Title string `json:"title"` Description string `json:"description"` CustomURL string `json:"customUrl"` @@ -99,7 +98,6 @@ func QueryYoutubeName(id string) (n string, err error) { } bodyBytes, err := ioutil.ReadAll(resp.Body) - fmt.Println("body ::: ", string(bodyBytes)) if err != nil { return "", err } @@ -109,7 +107,6 @@ func QueryYoutubeName(id string) (n string, err error) { }{} err = json.Unmarshal(bodyBytes, &apiRes) - fmt.Println("api resp ::: ", utils.ToMap(apiRes)) if err != nil { return "", err } @@ -119,10 +116,8 @@ func QueryYoutubeName(id string) (n string, err error) { } for _, v := range apiRes.Items { - fmt.Println("data :::: ", v) if v.ID == id { - fmt.Println("id match ::: ", v.Sinppet) - return v.Sinppet.Title, nil + return v.Snippet.Title, nil } }