|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
"os" |
|
|
|
"regexp" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/PuerkitoBio/goquery" |
|
|
|
) |
|
|
@ -76,7 +77,14 @@ func writeToFile(content []byte) error { |
|
|
|
} |
|
|
|
|
|
|
|
func operate(mensa string, day int) (Menu, error) { |
|
|
|
document, err := goquery.NewDocument(fmt.Sprintf("http://www.studentenwerk-goettingen.de/speiseplan.html?no_cache=1&day=%vpush=0&selectmensa=%s", day, mensa)) |
|
|
|
currentDay := int(time.Now().Weekday()) // week starts on sunday in go, but thats not relevant, because the canteen is closed on sunday
|
|
|
|
push := 0 |
|
|
|
if currentDay > day { |
|
|
|
push = 1 |
|
|
|
} |
|
|
|
|
|
|
|
document, err := goquery.NewDocument(fmt.Sprintf("http://www.studentenwerk-goettingen.de/speiseplan.html?no_cache=1&day=%v&push=%v&selectmensa=%s", day, push, mensa)) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return Menu{}, err |
|
|
|
} |
|
|
|