summaryrefslogtreecommitdiff
path: root/crawler/shop_whiskyworld.go
diff options
context:
space:
mode:
authorhorus2018-02-10 14:31:47 +0100
committerhorus2018-02-10 14:31:47 +0100
commit6e0858f00d941e96010b794c3f16e31cbef2e72d (patch)
tree86575cc63adc2cc918bb9d2397f2340beb31bfde /crawler/shop_whiskyworld.go
parent20a25c6069f626e16da35e3a29f91dae764a09bb (diff)
downloadalkobote-6e0858f00d941e96010b794c3f16e31cbef2e72d.tar.gz
Crawler extracts volume, price per litre and abv. (Whisky World)
Diffstat (limited to 'crawler/shop_whiskyworld.go')
-rw-r--r--crawler/shop_whiskyworld.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/crawler/shop_whiskyworld.go b/crawler/shop_whiskyworld.go
index 36b144e..8e4b984 100644
--- a/crawler/shop_whiskyworld.go
+++ b/crawler/shop_whiskyworld.go
@@ -44,6 +44,32 @@ func ScrapeWhiskyworld(shop Shop) []Angebot {
return
}
+ e.ForEach(".product-infobox", func(i int, e *colly.HTMLElement) {
+ text_noisy := e.ChildText(".item-inh")
+ W.Volume, err = extract_volume(text_noisy)
+ if err != nil {
+ log.Fatal(err)
+ }
+ abv_noisy := strings.TrimSpace(strings.SplitAfter(text_noisy, "Liter")[1])
+ abv_noisy = strings.TrimPrefix(abv_noisy, "/")
+ W.Abv, err = extract_abv(abv_noisy)
+ if err != nil {
+ log.Fatal(err)
+ }
+ })
+
+ e.ForEach(".price", func(i int, e *colly.HTMLElement) {
+ base_price_noisy := e.ChildText(".unit")
+ if strings.Contains(base_price_noisy, "Liter") {
+ base_price_noisy = strings.TrimSpace(strings.SplitAfter(base_price_noisy, "Liter")[0])
+ W.Base_price, err = sanitize_base_price(base_price_noisy)
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+
+ })
+
W.Image_url = "https:" + e.ChildAttr("img", "src")
W.Shop = shop.Id