This commit is contained in:
eson 2018-12-20 02:03:30 +08:00
parent efb9fe36a1
commit 887a0fd664

View File

@ -30,17 +30,29 @@ func (tt *Toutiao) GetSpiderID() int {
func (tt *Toutiao) ToDoParser(adstring string) (string, error) {
adstring = strconv.QuoteToASCII(adstring)
adstring = strings.Replace(adstring, "\\", "", -1)
log.Println(adstring)
// adstring = strconv.QuoteToASCII(adstring)
// adstring = strings.Replace(adstring, "\\", "", -1)
// log.Println(adstring)
var adlist interface{}
var adlist []string
if err := json.Unmarshal([]byte(adstring), &adlist); err != nil {
log.Println(err)
}
spew.Dump(adlist)
for _, data := range adlist {
data = strconv.QuoteToASCII(data)
data = strings.Replace(data, "\\", "", -1)
log.Println(data)
var jdata interface{}
if err := json.Unmarshal([]byte(data), &jdata); err != nil {
log.Println(err)
}
log.Println(jdata)
}
adparser := NewADParser(tt.GetSpiderID())
data, err := adparser.ToJSON()
if err != nil {