summaryrefslogtreecommitdiff
path: root/crawler/shop_whiskyzone.go
diff options
context:
space:
mode:
authorMaximilian Möhring2020-12-26 18:13:34 +0100
committerMaximilian Möhring2020-12-26 18:13:34 +0100
commit6dbd221d6da57d0345f6706e29a98b0075864fe1 (patch)
tree45ac215129b603dc2b3ac1e3bdf123e22e6c4fa5 /crawler/shop_whiskyzone.go
parent4982d0fc151c8fd4d14adb34b7b939b16777aa43 (diff)
downloadalkobote-6dbd221d6da57d0345f6706e29a98b0075864fe1.tar.gz
fix bug with whiskyzone
Diffstat (limited to 'crawler/shop_whiskyzone.go')
-rw-r--r--crawler/shop_whiskyzone.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/crawler/shop_whiskyzone.go b/crawler/shop_whiskyzone.go
index fa9d764..7ac8ac6 100644
--- a/crawler/shop_whiskyzone.go
+++ b/crawler/shop_whiskyzone.go
@@ -38,6 +38,7 @@ func (app *App) ScrapeWhiskyzone(shop Shop) []Angebot {
if "sold_out" == e.Request.Ctx.Get("sold_out") {
W.Println("Whiskyzone: Sold out")
+ e.Request.Ctx.Put("sold_out", "")
return
}
@@ -131,7 +132,7 @@ func (app *App) ScrapeWhiskyzone(shop Shop) []Angebot {
})
// ABV
- e.ForEach(".base-info--entry.entry-attribute", func(i int, e *colly.HTMLElement) {
+ e.ForEach(".base-info--entry.entry--attribute1", func(i int, e *colly.HTMLElement) {
text_noisy := e.ChildText(".entry--content")
if strings.Contains(text_noisy, "Alkoholgehalt") && strings.Contains(text_noisy, "%") {
@@ -145,13 +146,16 @@ func (app *App) ScrapeWhiskyzone(shop Shop) []Angebot {
})
// Product not found
- c.OnHTML(".detail-error--headline", func(e *colly.HTMLElement) {
+ c.OnHTML(".alert.is--error > .alert--content", func(e *colly.HTMLElement) {
if e.Request.URL.String() == Shop_url {
return
}
- e.Request.Ctx.Put("sold_out", "sold_out")
+ if strings.Contains(e.Text, "Dieser Artikel steht derzeit nicht zur Verfügung!") {
+ e.Request.Ctx.Put("sold_out", "sold_out")
+ }
+ return
})
err := c.Visit(Shop_url)