1
This commit is contained in:
Alex Yatskov 2015-08-17 14:23:03 +09:00
parent 6c5b62ece5
commit 315a279927

View File

@ -24,6 +24,11 @@ package main
import "log" import "log"
type scrapeTask struct {
url string
scr scraper
}
func main() { func main() {
gc, err := newGeoCache("cache/geocache.json") gc, err := newGeoCache("cache/geocache.json")
if err != nil { if err != nil {
@ -38,8 +43,15 @@ func main() {
t := tabelog{} t := tabelog{}
tasks := []scrapeTask{
{"http://tabelog.com/en/kanagawa/rstLst/1/", t},
}
out := make(chan restaurant) out := make(chan restaurant)
scrape("http://tabelog.com/en/kanagawa/rstLst/1/", out, wc, gc, t)
for _, task := range tasks {
scrape(task.url, out, wc, gc, task.scr)
}
for { for {
if _, ok := <-out; !ok { if _, ok := <-out; !ok {