Use parse function to parse responses, instead of channels.

Parse response as HTML Document using goquery.
Added simple README.
This commit is contained in:
Musab Gültekin
2019-06-06 22:48:57 +03:00
parent 1c96048082
commit 6358b87472
5 changed files with 80 additions and 38 deletions

View File

@ -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())
// })
// }
//}