diff options
Diffstat (limited to 'crawler/shop_bottleworld.go')
| -rw-r--r-- | crawler/shop_bottleworld.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/crawler/shop_bottleworld.go b/crawler/shop_bottleworld.go index 2eea3e5..db45791 100644 --- a/crawler/shop_bottleworld.go +++ b/crawler/shop_bottleworld.go @@ -1,7 +1,6 @@ package main import ( - log "github.com/Sirupsen/logrus" "regexp" "strings" @@ -33,13 +32,13 @@ func ScrapeBottleWord(shop Shop) []Angebot { e.ForEach(".old-price", func(i int, e *colly.HTMLElement) { W.Original_price, err = convert_price(e.ChildText(".price")) if err != nil { - log.Fatal(err) + Fatal(err, "Bottleworld: Converting original price failed") } }) e.ForEach(".special-price", func(i int, e *colly.HTMLElement) { W.Discounted_price, err = convert_price(e.ChildText(".price")) if err != nil { - log.Fatal(err) + Fatal(err, "Bottleworld: Converting discounted price failed") } }) }) @@ -47,7 +46,7 @@ func ScrapeBottleWord(shop Shop) []Angebot { price_per_litre_noisy := e.ChildText(".price-per-liter") price_per_litre, err := sanitize_base_price(price_per_litre_noisy) if err != nil { - log.Fatal(err) + Fatal(err, "Bottleworld: Sanitizing base price failed") } W.Base_price = price_per_litre @@ -58,7 +57,15 @@ func ScrapeBottleWord(shop Shop) []Angebot { W.Shop = shop.Id W.Volume = get_volume(e) + if W.Volume == 0 { + DebugOffer(W, "Bottleworld: Volume is zero") + return + } W.Abv = get_abv(e) + if W.Abv == 0 { + DebugOffer(W, "Bottleworld: Abv is zero") + return + } W.Spirit_type = e.Request.Ctx.Get("spirit_type") W.Website = e.Request.Ctx.Get("website") @@ -71,7 +78,7 @@ func ScrapeBottleWord(shop Shop) []Angebot { td_str := e.ChildText("td") matched, err := regexp.MatchString("^[0-9]+([,.][0-9]+)? l$", td_str) if err != nil { - log.Fatal(err) + Fatal(err, "Bottleworld: Volume and ABV Regex failed") } if matched { e.Request.Ctx.Put("volume", td_str) |
