diff options
| author | vin <git@vineetk.net> | 2023-11-21 11:07:28 -0500 |
|---|---|---|
| committer | vin <git@vineetk.net> | 2023-11-21 11:07:28 -0500 |
| commit | 6b0ed0f177f051961d45f7b6eaf120911c651331 (patch) | |
| tree | 95a472147f5631aeca5f998ab3608c1735f6aa54 /aplus.go | |
| parent | 3065b05ed45a04f401e8aec7d770b9e7a22c8ec4 (diff) | |
add verbose flag
Diffstat (limited to 'aplus.go')
| -rw-r--r-- | aplus.go | 14 |
1 files changed, 9 insertions, 5 deletions
| @@ -14,7 +14,9 @@ import ( | |||
| 14 | func submit_code(course_code int, attendance_code string) { | 14 | func submit_code(course_code int, attendance_code string) { |
| 15 | cur_body := launch_aplus(course_code) | 15 | cur_body := launch_aplus(course_code) |
| 16 | 16 | ||
| 17 | fmt.Printf("%s", cur_body) | 17 | if verbose { |
| 18 | fmt.Printf("%s", cur_body) | ||
| 19 | } | ||
| 18 | 20 | ||
| 19 | current_url := fmt.Sprintf("%s/student/", base_aplus_link) | 21 | current_url := fmt.Sprintf("%s/student/", base_aplus_link) |
| 20 | // the links to submit the code for a class is under the dayPanel div | 22 | // the links to submit the code for a class is under the dayPanel div |
| @@ -33,10 +35,12 @@ func submit_code(course_code int, attendance_code string) { | |||
| 33 | link_url := current_url + cur_body[link_start:link_end] | 35 | link_url := current_url + cur_body[link_start:link_end] |
| 34 | link_url = html.UnescapeString(link_url) | 36 | link_url = html.UnescapeString(link_url) |
| 35 | 37 | ||
| 36 | fmt.Println("!!!") | 38 | if verbose { |
| 37 | fmt.Printf("%i %i %i\n", daypanel_start, link_start, link_end) | 39 | fmt.Println("!!!") |
| 38 | fmt.Println(link_url) | 40 | fmt.Printf("%i %i %i\n", daypanel_start, link_start, link_end) |
| 39 | fmt.Println("!!!") | 41 | fmt.Println(link_url) |
| 42 | fmt.Println("!!!") | ||
| 43 | } | ||
| 40 | 44 | ||
| 41 | resp, _ := client.Get(link_url) | 45 | resp, _ := client.Get(link_url) |
| 42 | body, _ := io.ReadAll(resp.Body) | 46 | body, _ := io.ReadAll(resp.Body) |
