This commit is contained in:
huangsimin 2018-12-20 10:26:18 +08:00
parent 9446dba6ab
commit af9f659ff6

View File

@ -9,8 +9,6 @@ import (
"testing"
"github.com/tidwall/gjson"
"github.com/davecgh/go-spew/spew"
)
func TestParser(t *testing.T) {
@ -42,12 +40,14 @@ func (tt *Toutiao) ToDoParser(adstring string) (string, error) {
log.Println(err)
}
spew.Dump(adlist)
for _, data := range adlist {
var v interface{}
log.Println(gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).Exists())
data = strings.Trim(data, "\"")
unq, _ := strconv.Unquote("\"" + data + "\"")
log.Println(gjson.Unmarshal([]byte(data), &v), gjson.Parse(data).Exists())
data = unq
result := gjson.Parse(data)
@ -57,7 +57,6 @@ func (tt *Toutiao) ToDoParser(adstring string) (string, error) {
log.Println(result.Get("mixed.track_url"))
}
var v interface{}
json.Unmarshal([]byte(data), &v)
// spew.Dump(v)
regexp.Compile(``)