summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorus2018-09-16 17:17:51 +0200
committerhorus2018-09-16 17:17:51 +0200
commit936b69db2578b070c46157e901c69a83ab5f561a (patch)
tree985ce06c6482659645a9c4199afa41a827939c67
parentd1ce36763bb1f5dc3d4f58b59a20cffc2b03a3a4 (diff)
downloadalkobote-936b69db2578b070c46157e901c69a83ab5f561a.tar.gz
Fix crawler for Drankdozijn. (crawler)
-rw-r--r--crawler/shop_drankdozijn.go16
1 files changed, 14 insertions, 2 deletions
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)
}