Exporting data all types support added.
This commit is contained in:
parent
d967555b62
commit
9263877339
@ -23,6 +23,8 @@ func Export(response *Response) {
|
|||||||
|
|
||||||
for res := range response.Exports {
|
for res := range response.Exports {
|
||||||
//fmt.Println(res)
|
//fmt.Println(res)
|
||||||
_ = json.NewEncoder(file).Encode(res)
|
encoder := json.NewEncoder(file)
|
||||||
|
encoder.SetEscapeHTML(false)
|
||||||
|
encoder.Encode(res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ func (g *Geziyor) Do(req *http.Request) {
|
|||||||
Body: body,
|
Body: body,
|
||||||
Doc: doc,
|
Doc: doc,
|
||||||
Geziyor: g,
|
Geziyor: g,
|
||||||
Exports: make(chan map[string]interface{}, 1),
|
Exports: make(chan interface{}, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export Function
|
// Export Function
|
||||||
|
@ -22,7 +22,8 @@ func TestGeziyor_IP(t *testing.T) {
|
|||||||
StartURLs: []string{"http://api.ipify.org"},
|
StartURLs: []string{"http://api.ipify.org"},
|
||||||
Cache: httpcache.NewMemoryCache(),
|
Cache: httpcache.NewMemoryCache(),
|
||||||
ParseFunc: func(r *geziyor.Response) {
|
ParseFunc: func(r *geziyor.Response) {
|
||||||
fmt.Println(string(r.Body))
|
fmt.Println(r.Doc.Text())
|
||||||
|
r.Exports <- r.Doc.Text()
|
||||||
r.Geziyor.Get("http://api.ipify.org")
|
r.Geziyor.Get("http://api.ipify.org")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -14,7 +14,7 @@ type Response struct {
|
|||||||
Doc *goquery.Document
|
Doc *goquery.Document
|
||||||
|
|
||||||
Geziyor *Geziyor
|
Geziyor *Geziyor
|
||||||
Exports chan map[string]interface{}
|
Exports chan interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JoinURL joins base response URL and provided relative URL.
|
// JoinURL joins base response URL and provided relative URL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user