From 936b69db2578b070c46157e901c69a83ab5f561a Mon Sep 17 00:00:00 2001 From: horus Date: Sun, 16 Sep 2018 17:17:51 +0200 Subject: Fix crawler for Drankdozijn. (crawler) --- crawler/shop_drankdozijn.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'crawler') diff --git a/crawler/shop_drankdozijn.go b/crawler/shop_drankdozijn.go index 96d914d..9a841ce 100644 --- a/crawler/shop_drankdozijn.go +++ b/crawler/shop_drankdozijn.go @@ -17,10 +17,10 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { Offers := []Angebot{} types := map[int]string{230: "Whisky", 270: "Gin", 220: "Wodka", 210: "Rum", 250: "Likör", 240: "Cognac", 100: "Champagner"} - //types := map[int]string{240: "Likör"} + //types := map[int]string{250: "Likör"} var current_type string - c := app.customCollector([]string{"drankdozijn.de"}) + c := app.customCollector([]string{"drankdozijn.de", "drankdozijn.nl"}) c.OnHTML(".product_top", func(e *colly.HTMLElement) { @@ -109,6 +109,15 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { if current_type == "Cognac" { W.Spirit_type = e.Request.Ctx.Get("spirit_type") } + + if current_type == "Likör" { + tmp_type := e.Request.Ctx.Get("spirit_type") + switch tmp_type { + case "Tequila": + W.Spirit_type = "Tequila" + } + } + if current_type == "Champagner" && e.Request.Ctx.Get("spirit_type") != "Champagner" { DebugOffer(W, "Drankdozijn: Skip Offer") return @@ -135,10 +144,13 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { } else { switch strings.TrimSpace(prev) { case "Inhalt": + case "Inhoud": e.Request.Ctx.Put("volume", e.Text) case "Alkoholgehalt": + case "Alcoholpercentage": e.Request.Ctx.Put("abv", e.Text) case "Kategorie": + case "Categorie": e.Request.Ctx.Put("spirit_type", e.Text) } -- cgit v1.2.3