Use parse function to parse responses, instead of channels.
Parse response as HTML Document using goquery. Added simple README.
This commit is contained in:
@ -5,10 +5,22 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGezer_StartURLs(t *testing.T) {
|
||||
gezer := NewGezer()
|
||||
gezer.StartURLs("https://api.ipify.org")
|
||||
for result := range gezer.Results {
|
||||
fmt.Println(string(result.Body))
|
||||
}
|
||||
func TestGezer_StartURLs_Simple(t *testing.T) {
|
||||
gezer := NewGezer(parse, "https://api.ipify.org", "https://api.ipify.org")
|
||||
gezer.Start()
|
||||
}
|
||||
|
||||
func parse(response *Response) {
|
||||
fmt.Println(string(response.Body))
|
||||
}
|
||||
|
||||
//func TestGezer_StartURLs_HTML(t *testing.T) {
|
||||
// gezer := NewGezer(parse, "http://quotes.toscrape.com/")
|
||||
// gezer.Start()
|
||||
// for result := range gezer.Results {
|
||||
// result.Doc.Find("div.quote").Each(func(_ int, s *goquery.Selection) {
|
||||
// fmt.Println(s.Find("span.text").Text())
|
||||
// fmt.Println(s.Find("small.author").Text())
|
||||
// })
|
||||
// }
|
||||
//}
|
||||
|
Reference in New Issue
Block a user