From a707f0a6ca96c81a178acce34f0492c6c601c43b Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sun, 4 Sep 2022 15:45:52 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=D1=80=D0=B0=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parser/parser.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index 3699708..e084bce 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -1,13 +1,18 @@ package parser import ( - "github.com/PuerkitoBio/goquery" + "fmt" "io" "log" "net/http" "strings" + "time" + + "github.com/PuerkitoBio/goquery" ) +const scheduleURLTemplate = "https://www.asu.ru/timetable/students/12/2129440415/?date=%s-%s" + type Lesson struct { Day int Number string @@ -22,7 +27,12 @@ func ParseByDay(day int) []Lesson { } func parse() []Lesson { - url := "https://www.asu.ru/timetable/students/12/2129440415/" + location, err := time.LoadLocation("Asia/Novosibirsk") + if err != nil { + panic(err) + } + now := time.Now().In(location) + url := fmt.Sprintf(scheduleURLTemplate, now.Format("20060102"), now.Add(24*time.Hour).Format("20060102")) // Get html res, err := http.Get(url)