geziyor/gezer_test.go
Musab Gültekin 6358b87472 Use parse function to parse responses, instead of channels.
Parse response as HTML Document using goquery.
Added simple README.
2019-06-06 22:48:57 +03:00

27 lines
605 B
Go

package gezer
import (
"fmt"
"testing"
)
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())
// })
// }
//}