summaryrefslogtreecommitdiff
path: root/crawler/shop_whiskyzone.go
diff options
context:
space:
mode:
Diffstat (limited to 'crawler/shop_whiskyzone.go')
-rw-r--r--crawler/shop_whiskyzone.go34
1 files changed, 25 insertions, 9 deletions
diff --git a/crawler/shop_whiskyzone.go b/crawler/shop_whiskyzone.go
index 8d86b8a..f01e93f 100644
--- a/crawler/shop_whiskyzone.go
+++ b/crawler/shop_whiskyzone.go
@@ -6,7 +6,7 @@ import (
"github.com/gocolly/colly"
)
-func ScrapeWhiskyzone(shop Shop) []Angebot {
+func (app *App) ScrapeWhiskyzone(shop Shop) []Angebot {
Shop_url := "https://www.whiskyzone.de/widgets/emotion/index/emotionId/248/controllerName/listing"
@@ -45,23 +45,33 @@ func ScrapeWhiskyzone(shop Shop) []Angebot {
var err error
W.Discounted_price, err = convert_price(e.Request.Ctx.Get("discounted_price"))
if err != nil {
- Fatal(err, "Whiskyzone: Convert discounted price failed")
+ W.error_msg = err.Error()
+ W.error_ctx = e.Request.Ctx.Get("discounted_price")
+ WarnOffer(W, "Whiskyzone: Convert discounted price failed")
+ return
}
W.Original_price, err = convert_price(e.Request.Ctx.Get("original_price"))
if err != nil {
- Fatal(err, "Whiskyzone: Convert original price failed")
+ W.error_msg = err.Error()
+ W.error_ctx = e.Request.Ctx.Get("original_price")
+ WarnOffer(W, "Whiskyzone: Convert original price failed")
+ return
}
- W.Volume = get_volume(e)
- W.Abv = get_abv(e)
-
+ var ctx string
+ W.Volume, ctx = get_volume(e)
if W.Volume == 0 {
- DebugOffer(W, "Whiskyzone: Volume is zero")
+ W.error_msg = "Whiskyzone: Volume is zero"
+ W.error_ctx = ctx
+ WarnOffer(W, "Whiskyzone: Volume is zero")
return
}
+ W.Abv, ctx = get_abv(e)
if W.Abv == 0 {
- DebugOffer(W, "Whiskyzone: Abv is zero")
+ W.error_msg = "Whiskyzone: Abv is zero"
+ W.error_ctx = ctx
+ WarnOffer(W, "Whiskyzone: Abv is zero")
return
}
@@ -69,7 +79,13 @@ func ScrapeWhiskyzone(shop Shop) []Angebot {
if base_price == "same_as_discounted_price" {
W.Base_price = W.Discounted_price
} else {
- W.Base_price = get_base_price(e)
+ W.Base_price, err = get_base_price(e)
+ if err != nil {
+ W.error_msg = err.Error()
+ W.error_ctx = base_price
+ WarnOffer(W, "Whiskyzone: Extracting base price failed")
+ return
+ }
}
W.Website = e.Request.Ctx.Get("website")