README updated for more advanced usage. Updated tests.

This commit is contained in:
Musab Gültekin
2019-06-12 22:22:01 +03:00
parent d56ea161a5
commit 184081d3bf
2 changed files with 33 additions and 4 deletions

View File

@@ -54,6 +54,7 @@ func quotesParse(r *geziyor.Response) {
return s.Text()
}),
}
// Or, for CSV
//r.Exports <- []string{s.Find("span.text").Text(), s.Find("small.author").Text()}
})
@@ -97,9 +98,11 @@ func TestStartRequestsFunc(t *testing.T) {
g.Requests <- &geziyor.Request{Request: req}
},
ParseFunc: func(r *geziyor.Response) {
r.Exports <- []string{r.Status}
r.DocHTML.Find("a").Each(func(_ int, s *goquery.Selection) {
r.Exports <- s.AttrOr("href", "")
})
},
Exporters: []geziyor.Exporter{exporter.CSVExporter{}},
Exporters: []geziyor.Exporter{exporter.JSONExporter{}},
}).Start()
}