summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorus_arch2018-02-10 12:27:25 +0100
committerhorus_arch2018-02-10 12:27:25 +0100
commit0dbc07daf301908e1b983fcf70a760ef8a29b898 (patch)
tree64472bb992114efc1f825c2ce22c14b4a08aefa9
parent217a36a1ef918bec39bf1485c6e4d5d8def58886 (diff)
downloadalkobote-0dbc07daf301908e1b983fcf70a760ef8a29b898.tar.gz
Improves whiskyde. (crawler)
-rw-r--r--crawler/shop_whiskyde.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/crawler/shop_whiskyde.go b/crawler/shop_whiskyde.go
index f3c5f3f..de55600 100644
--- a/crawler/shop_whiskyde.go
+++ b/crawler/shop_whiskyde.go
@@ -52,9 +52,36 @@ func ScrapeWhiskyde(shop Shop) []Angebot {
//W.Valid_until = e.ChildText(".article-price-special")
})
+ e.ForEach(".article-amount", func(i int, e *colly.HTMLElement) {
+ text_noisy := e.ChildText("span")
+
+ if strings.Contains("Liter", text_noisy) {
+ W.Volume, err = extract_volume(text_noisy)
+ if err != nil {
+ log.Fatal(err)
+ }
+ } else {
+ W.Abv, err = extract_abv(text_noisy)
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+ })
+ if W.Volume == 0 {
+ log.Println(W.Name + " kein Volume erkannt")
+ }
+ if W.Abv == 0 {
+ log.Println(W.Name + " kein Abv erkannt")
+ }
+
W.Shop = shop.Id
W.Spirit_type = "Whisky"
+ W.Base_price, err = convert_price(e.ChildText(".article-unitprice-default"))
+ if err != nil {
+ log.Fatal(err)
+ }
+
Whiskys = append(Whiskys, W)
})