diff --git a/parser_test.go b/parser_test.go index 5e18761..28d3bf4 100644 --- a/parser_test.go +++ b/parser_test.go @@ -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(``)