summary refs log tree commit diff stats
path: root/cmd/cetus-bing/cetus-bing.go
diff options
context:
space:
mode:
authorAndinus <andinus@inventati.org>2020-03-15 17:29:01 +0530
committerAndinus <andinus@inventati.org>2020-03-15 17:29:01 +0530
commitba8d3148ee99d18db4d6e3e69981b7e29b6e392f (patch)
tree9d0534237a4fcadb7a2df6f0926cc45e19559ea1 /cmd/cetus-bing/cetus-bing.go
parenta22d31258ff92d8b2e199e1bdd6e898c6519c707 (diff)
downloadcetus-0.4.5.tar.gz
cetus-bing: Correct date format v0.4.5
Diffstat (limited to 'cmd/cetus-bing/cetus-bing.go')
-rw-r--r--cmd/cetus-bing/cetus-bing.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/cmd/cetus-bing/cetus-bing.go b/cmd/cetus-bing/cetus-bing.go
index e4aae89..9b06379 100644
--- a/cmd/cetus-bing/cetus-bing.go
+++ b/cmd/cetus-bing/cetus-bing.go
@@ -63,7 +63,18 @@ func main() {
 	// responses, choose a random response from the list
 	var i int = rand.Intn(len(bpodRes.Photos))
 	bpodPhoto = bpodRes.Photos[i]
+
+	// correct image path
 	bpodPhoto.URL = fmt.Sprintf("%s%s", "https://www.bing.com", bpodPhoto.URL)
+
+	// correct date format
+	var dt time.Time
+	dt, err = time.Parse("20060102", bpodPhoto.StartDate)
+	if err != nil {
+		log.Fatal(err)
+	}
+	bpodPhoto.StartDate = dt.Format("2006-01-02")
+
 	printDetails(bpodPhoto)
 
 	// if fetchOnly is true then don't set background
@@ -105,7 +116,7 @@ func printDetails(bpodPhoto bing.Photo) {
 	fmt.Printf("Copyright: %s\n", bpodPhoto.Copyright)
 	fmt.Printf("Copyright Link: %s\n", bpodPhoto.CopyrightLink)
 	fmt.Printf("Date: %s\n\n", bpodPhoto.StartDate)
-	fmt.Printf("URL: %s\n\n", bpodPhoto.URL)
+	fmt.Printf("URL: %s\n", bpodPhoto.URL)
 }
 
 func getBPODRes() (bing.BPOD, error) {
/span> ^
a9817844 ^
a9817844 ^
6e1eeeeb ^
a9817844 ^
b96af395 ^
6e1eeeeb ^








aeac1e06 ^
6e1eeeeb ^
aeac1e06 ^
6e1eeeeb ^


2c64c52e ^
f88f77cd ^
6e1eeeeb ^
b2c8b732 ^

14a06183 ^

b2c8b732 ^
4c131b38 ^
85eb8167 ^
f88f77cd ^
2844327a ^



a5fa9785 ^
8e607b12 ^
eafdbfc1 ^
2844327a ^

2844327a ^
85eb8167 ^
2844327a ^
a5fa9785 ^
8e607b12 ^
4c131b38 ^
2844327a ^
8e607b12 ^
2844327a ^






6e1eeeeb ^
6e1eeeeb ^




890df1de ^
c7c8eb0c ^








b67270e1 ^
c7c8eb0c ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99