package main import ( "encoding/json" "fmt" "html" "io" "net/http" "net/url" "strings" ) func launch_aplus(course_code int) { aplus_link := fmt.Sprintf("%s/courses/%d/external_tools/sessionless_launch?id=913&access_token=%s", base_link, course_code, token) // 7329 always works aplus := get_aplus(token, aplus_link, client) resp, _ := client.Get(aplus) body, _ := io.ReadAll(resp.Body) form_str := get_form_from_request_body(body) form_values := parse_form(form_str) resp, _ = client.PostForm("https://floridapoly.aplusattendance.com/canvas", form_values) body, _ = io.ReadAll(resp.Body) fmt.Println(string(body)) } func get_aplus(token string, link string, client http.Client) string { resp, _ := client.Get(link) body, _ := io.ReadAll(resp.Body) var aplus Aplus json.Unmarshal(body, &aplus) return aplus.URL } func get_form_from_request_body(req_body []byte) string { body_str := string(req_body) form_start := strings.Index(body_str, "") + 7 form_html := req_body[form_start:form_end] return string(form_html) } // parse_form extracts form fields and values from the given HTML form string. func parse_form(form_html string) url.Values { form_values := make(url.Values) inputs := strings.Split(form_html, "