|
|
@ -94,6 +94,8 @@ func GetFavicon(url string) (string, error) {
|
|
94
|
94
|
if err != nil {
|
|
95
|
95
|
return "", err
|
|
96
|
96
|
}
|
|
|
97
|
defer resp.Body.Close()
|
|
|
98
|
|
|
97
|
99
|
tree, err := html.Parse(resp.Body)
|
|
98
|
100
|
fmt.Println("parse html", tree, err)
|
|
99
|
101
|
if err != nil {
|
|
|
@ -126,6 +128,7 @@ func GetCanonicalFavicon(u string) (string, error) {
|
|
126
|
128
|
if err != nil {
|
|
127
|
129
|
return "", err
|
|
128
|
130
|
}
|
|
|
131
|
defer resp.Body.Close()
|
|
129
|
132
|
if resp.StatusCode >= 400 || resp.Header.Get("Content-Length") == "0" {
|
|
130
|
133
|
return "", errors.New("no /favicon.ico")
|
|
131
|
134
|
}
|