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)