From af9f659ff61ac1b467bc73ba6b7e557b36e1fcf0 Mon Sep 17 00:00:00 2001 From: huangsimin Date: Thu, 20 Dec 2018 10:26:18 +0800 Subject: [PATCH] for test --- parser_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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(``)