diff options
| author | Max | 2018-02-08 18:26:41 +0100 |
|---|---|---|
| committer | Max | 2018-02-08 18:26:41 +0100 |
| commit | f6904aab20e2d09255fd0adabfd246165ff3cb02 (patch) | |
| tree | f7ac27cb5dd34443640235a97ce9bde8f2a1816a /crawler/sanitize.go | |
| parent | ae7ed42df6a55e36c82b88e7c71569951847a68c (diff) | |
| download | alkobote-f6904aab20e2d09255fd0adabfd246165ff3cb02.tar.gz | |
Crawler extracts volume, price per litre and abv. (MC Whisky, Rum & Co, Whic)
Diffstat (limited to 'crawler/sanitize.go')
| -rw-r--r-- | crawler/sanitize.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/crawler/sanitize.go b/crawler/sanitize.go index fc4ee81..a40745a 100644 --- a/crawler/sanitize.go +++ b/crawler/sanitize.go @@ -92,10 +92,32 @@ func sanitize_name(name string) string { return name } -func sanitize_price_per(price_noisy string) (price int, err error) { +func sanitize_base_price(price_noisy string) (price int, err error) { if strings.Contains(price_noisy, "Preis pro Liter") { price_noisy = strings.Replace(price_noisy, "Preis pro Liter", "", -1) } + if strings.Contains(price_noisy, " pro 1 l") { + price_noisy = strings.Replace(price_noisy, " pro 1 l", "", -1) + } + + if strings.Contains(price_noisy, " pro 1 stück") { + price_noisy = strings.Replace(price_noisy, " pro 1 stück", "", -1) + } + + if strings.Contains(price_noisy, " pro 1 Stück") { + price_noisy = strings.Replace(price_noisy, " pro 1 Stück", "", -1) + } + + if strings.Contains(price_noisy, "Grundpreis:") { + price_noisy = strings.Replace(price_noisy, "Grundpreis", "", -1) + price_noisy = strings.TrimSpace(price_noisy) + } + + if strings.Contains(price_noisy, "/Liter") { + price_noisy = strings.Replace(price_noisy, "/Liter", "", -1) + price_noisy = strings.TrimSpace(price_noisy) + } + return convert_price(price_noisy) } |
