From 01cdf12b54fea6fc643d35f5812a84a2b3a0c0d4 Mon Sep 17 00:00:00 2001 From: Redume Date: Mon, 19 Sep 2022 02:06:17 +0300 Subject: [PATCH] rename var --- functions/wallpaper.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/functions/wallpaper.go b/functions/wallpaper.go index 94e30bb..630a303 100644 --- a/functions/wallpaper.go +++ b/functions/wallpaper.go @@ -22,7 +22,7 @@ func GetWallpaper() string { panic(marshalErr) } - type Wallpaper struct { + type WallpaperStruct struct { Hdurl string `json:"hdurl"` Url string `json:"url"` Media_type string `json:"media_type"` @@ -39,20 +39,19 @@ func GetWallpaper() string { panic(StringErr) } - var wallpaper Wallpaper - jsonErr := json.Unmarshal([]byte(body), &wallpaper) + var Wallpaper WallpaperStruct + jsonErr := json.Unmarshal([]byte(body), &Wallpaper) if jsonErr != nil { panic(jsonErr) } - if wallpaper.Media_type == "video" { - wallpaper.Url = wallpaper.Url[30 : len(wallpaper.Url)-6] - - return "https://img.youtube.com/vi/" + wallpaper.Url + "/0.jpg" + if Wallpaper.Media_type == "video" { + Wallpaper.Url = Wallpaper.Url[30 : len(Wallpaper.Url)-6] + return "https://img.youtube.com/vi/" + Wallpaper.Url + "/0.jpg" } - return wallpaper.Hdurl + return Wallpaper.Hdurl } func SetWallpaper() {