Fix warnings
This commit is contained in:
parent
4ea167fde0
commit
891a952e9b
17
api/user.go
17
api/user.go
|
@ -3,7 +3,6 @@ package api
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -35,8 +34,6 @@ type Submission struct {
|
||||||
IsAlbum bool
|
IsAlbum bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgurRe = regexp.MustCompile(`https?://i?\.?imgur\.com`)
|
|
||||||
|
|
||||||
func (client *Client) FetchUser(username string) (User, error) {
|
func (client *Client) FetchUser(username string) (User, error) {
|
||||||
cacheData, found := client.Cache.Get(username + "-user")
|
cacheData, found := client.Cache.Get(username + "-user")
|
||||||
if found {
|
if found {
|
||||||
|
@ -93,7 +90,12 @@ func (client *Client) FetchSubmissions(username string, sort string, page string
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
coverData := value.Get("images.#(id==\"" + value.Get("cover").String() + "\")")
|
coverData := value.Get("images.#(id==\"" + value.Get("cover").String() + "\")")
|
||||||
cover := Media{}
|
cover := Media{
|
||||||
|
Id: value.Get("id").String(),
|
||||||
|
Description: value.Get("description").String(),
|
||||||
|
Type: strings.Split(value.Get("type").String(), "/")[0],
|
||||||
|
Url: strings.ReplaceAll(value.Get("link").String(), "https://i.imgur.com", ""),
|
||||||
|
}
|
||||||
if coverData.Exists() {
|
if coverData.Exists() {
|
||||||
cover = Media{
|
cover = Media{
|
||||||
Id: coverData.Get("id").String(),
|
Id: coverData.Get("id").String(),
|
||||||
|
@ -101,13 +103,6 @@ func (client *Client) FetchSubmissions(username string, sort string, page string
|
||||||
Type: strings.Split(coverData.Get("type").String(), "/")[0],
|
Type: strings.Split(coverData.Get("type").String(), "/")[0],
|
||||||
Url: strings.ReplaceAll(coverData.Get("link").String(), "https://i.imgur.com", ""),
|
Url: strings.ReplaceAll(coverData.Get("link").String(), "https://i.imgur.com", ""),
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
cover = Media{
|
|
||||||
Id: value.Get("id").String(),
|
|
||||||
Description: value.Get("description").String(),
|
|
||||||
Type: strings.Split(value.Get("type").String(), "/")[0],
|
|
||||||
Url: strings.ReplaceAll(value.Get("link").String(), "https://i.imgur.com", ""),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id := value.Get("id").String()
|
id := value.Get("id").String()
|
||||||
|
|
Loading…
Reference in New Issue