summaryrefslogtreecommitdiff
path: root/crawler
diff options
context:
space:
mode:
authorhorus2018-09-16 18:22:05 +0200
committerhorus2018-09-16 18:22:05 +0200
commit20daade949655b9fa07195b7140964dd10005f23 (patch)
treef539304ddb150ac8457ddeb26ac07e655f2590d3 /crawler
parentf59e43e34fdf52a6f6c76386e67823dd463aaf7d (diff)
downloadalkobote-20daade949655b9fa07195b7140964dd10005f23.tar.gz
Fix crawler for Rum & Co. (crawler)
Diffstat (limited to 'crawler')
-rw-r--r--crawler/shop_rumundco.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/crawler/shop_rumundco.go b/crawler/shop_rumundco.go
index 45069c2..275e60a 100644
--- a/crawler/shop_rumundco.go
+++ b/crawler/shop_rumundco.go
@@ -10,6 +10,7 @@ import (
func (app *App) ScrapeRumundCo(shop Shop) []Angebot {
+ // kf=29 means Whisky
Shop_url := "https://www.rumundco.de/navi.php?q=4&kf=29&kk-suesse-von=0&kk-suesse-bis=100&kk-milde-von=0&kk-milde-bis=100&kk-wuerze-von=0&kk-wuerze-bis=100&kk-frucht-von=0&kk-frucht-bis=100&kk-torf-von=0&kk-torf-bis=100&hf=0&af=90&Sortierung=11&a=350"
Whiskys := []Angebot{}
@@ -51,7 +52,7 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot {
abv_noisy := r_abv.FindString(whisky_name)
e.ForEach(".price_wrapper", func(i int, e *colly.HTMLElement) {
- regular_price := e.ChildText("del.value")
+ regular_price := e.ChildText(".instead_of")
if "" == regular_price {
W.error_msg = "Rum & Co: No regular price found"
W.error_ctx = regular_price
@@ -146,9 +147,12 @@ func (app *App) ScrapeRumundCo(shop Shop) []Angebot {
e.ForEach("tr", func(i int, e *colly.HTMLElement) {
text_noisy := e.ChildText("th")
- if strings.Contains(text_noisy, "Genauer Inhalt:") {
+ switch text_noisy {
+ case "Genauer Inhalt:":
e.Request.Ctx.Put("volume", e.ChildText("td"))
- } else if strings.Contains(text_noisy, "Alkoholgehalt in %:") {
+ case "Inhalt:":
+ e.Request.Ctx.Put("volume", e.ChildText("td"))
+ case "Alkoholgehalt in %:":
e.Request.Ctx.Put("abv", e.ChildText("a"))
}
})