diff options
| author | horus | 2018-06-16 17:00:43 +0200 |
|---|---|---|
| committer | horus | 2018-06-16 17:00:43 +0200 |
| commit | f61abc2069936f600c153d019b5f7a8c9a234e24 (patch) | |
| tree | be315d4b908b3c22e491c4cc61d5d224fc068914 /crawler/shop_drankdozijn.go | |
| parent | 2588017275b32f8f433c732fbb89100fe87c3e96 (diff) | |
| download | alkobote-f61abc2069936f600c153d019b5f7a8c9a234e24.tar.gz | |
Bugfix. (crawler)
Diffstat (limited to 'crawler/shop_drankdozijn.go')
| -rw-r--r-- | crawler/shop_drankdozijn.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crawler/shop_drankdozijn.go b/crawler/shop_drankdozijn.go index adc8633..96d914d 100644 --- a/crawler/shop_drankdozijn.go +++ b/crawler/shop_drankdozijn.go @@ -16,8 +16,8 @@ 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", "Champagner": 100} - //types := map[int]string{100: "Champagner"} + 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"} var current_type string c := app.customCollector([]string{"drankdozijn.de"}) @@ -35,6 +35,7 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { W.Spirit_type = current_type var err error + var skip_offer bool e.ForEach(".product_image", func(i int, e *colly.HTMLElement) { W.Url = e.ChildAttr("a", "href") @@ -50,7 +51,13 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { } e.ForEach(".product_price", func(i int, e *colly.HTMLElement) { - W.Original_price, err = convert_price(e.ChildText(".product_acties")) + original_price_noisy := e.ChildText(".product_acties") + if !strings.Contains(original_price_noisy, "€") { + PrintlnOffer(W, "Drankdozijn: Original price has no € sign. Skipping!") + skip_offer = true + return + } + W.Original_price, err = convert_price(original_price_noisy) if err != nil { W.error_msg = err.Error() W.error_ctx = e.ChildText(".product_acties") @@ -66,6 +73,10 @@ func (app *App) ScrapeDrankdozijn(shop Shop) []Angebot { } }) + if skip_offer { + return + } + e.Request.Visit(W.Url) var ctx string |
