File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -9,19 +9,22 @@ import (
9
9
"github.com/jedib0t/go-pretty/v6/table"
10
10
)
11
11
12
+
12
13
func main () {
13
- var ids []string
14
- url := "https://e3.nycu.edu.tw/"
15
14
var session string
15
+ var only_in_progress bool
16
16
flag .StringVar (& session , "session" , "" , "Set session cookie" )
17
17
flag .StringVar (& session , "s" , "" , "Set session cookie" )
18
- var only_in_progress bool
19
18
flag .BoolVar (& only_in_progress , "only-in-progress" , false , "Only show in progress homework." )
20
19
flag .Parse ()
21
- if session == "" {
22
- fmt .Println ( "Session cookie must be provided. " )
23
- os . Exit ( 1 )
20
+ for session == "" {
21
+ fmt .Print ( "Please enter your session (the cookie `MoodleSession`): " )
22
+ fmt . Scanln ( & session )
24
23
}
24
+ fmt .Println ("Fecthing the data, please wait..." )
25
+
26
+ var ids []string
27
+ url := "https://e3.nycu.edu.tw/"
25
28
26
29
collector := colly .NewCollector ()
27
30
collector .OnResponse (func (r * colly.Response ){
@@ -61,7 +64,7 @@ func main() {
61
64
})
62
65
var submitted [5 ][]string
63
66
var overdue [5 ][]string
64
- if ! only_in_progress {
67
+ if ! only_in_progress {
65
68
// submitted
66
69
collector .OnHTML ("#news-view-nofile2-tobegraded-in-progress tbody tr .instancename" , func (e * colly.HTMLElement ) {
67
70
// HW name
You can’t perform that action at this time.
0 commit comments