for test
This commit is contained in:
parent
9446dba6ab
commit
af9f659ff6
|
@ -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(``)
|
||||
|
|
Loading…
Reference in New Issue
Block a user