mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-18 20:50:12 +08:00
fix: danbooru
This commit is contained in:
parent
61168adb2e
commit
54c67e30f4
@ -3,6 +3,7 @@ package deepdanbooru
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -59,8 +60,12 @@ func tagurl(name, u string) (im image.Image, st *sorttags, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(data) < 4 {
|
||||||
|
err = errors.New("data too short")
|
||||||
|
return
|
||||||
|
}
|
||||||
tags := make(map[string]float64)
|
tags := make(map[string]float64)
|
||||||
err = json.Unmarshal(data, &tags)
|
err = json.Unmarshal(data[1:len(data)-1], &tags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user