summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorhorus_arch2018-02-04 20:02:14 +0100
committerhorus_arch2018-02-04 20:02:14 +0100
commit0687b4217abf0c278bcab50de4edafec76da4a91 (patch)
treef14114b445b355468db14cd8143aac4a31720e63 /main.go
parentc2ffa908a41ae8b4f8cd9471e2ecd927ece94631 (diff)
downloadalkobote-0687b4217abf0c278bcab50de4edafec76da4a91.tar.gz
Saves the data in a structured way.
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/main.go b/main.go
index 79f578b..3a8efa3 100644
--- a/main.go
+++ b/main.go
@@ -10,8 +10,8 @@ type Angebot struct {
Name string
Shop string
Url string
- Original_price string
- Discounted_price string
+ Original_price int
+ Discounted_price int
Image_url string
Spirit_type string
Valid_until string
@@ -30,15 +30,8 @@ func main() {
ScrapeWhic()
*/
- printName("Whisky.de")
W := ScrapeWhiskyde()
-
- output, err := json.Marshal(W)
- if err != nil {
- log.Fatal(err)
- }
-
- fmt.Println(string(output))
+ printName(W, "Whisky.de")
/*
printName("Whiskysite.nl")
@@ -55,8 +48,15 @@ func main() {
*/
}
-func printName(name string) {
+func printName(W []Angebot, name string) {
fmt.Println("-------------------")
fmt.Println("Sonderangebote von " + name)
fmt.Println("-------------------")
+
+ output, err := json.MarshalIndent(W, "", " ")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ fmt.Println(string(output))
}