213
This commit is contained in:
parent
efb9fe36a1
commit
887a0fd664
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user