Last active
August 31, 2026 02:13
-
-
Save 0mhx/8f7505becdd385665b548846d33844ea to your computer and use it in GitHub Desktop.
get courses list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // run this on a course page, it will also print in the console too | |
| // this code was being weird pls dont flame me | |
| window.baseFind = (p) => | |
| fetch( | |
| `${location.origin}/enrollments/edit/members/course/${window.location.href.split("/").at(-2)}/ajax?p=1&s=`, | |
| { | |
| credentials: "include", | |
| headers: { | |
| "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0", | |
| Accept: "text/html, */*; q=0.01", | |
| "Accept-Language": "en-US,en;q=0.5", | |
| "X-Requested-With": "XMLHttpRequest", | |
| "Sec-Fetch-Dest": "empty", | |
| "Sec-Fetch-Mode": "cors", | |
| "Sec-Fetch-Site": "same-origin", | |
| Priority: "u=0", | |
| }, | |
| method: "GET", | |
| mode: "cors", | |
| }, | |
| ).then((res) => res.text()); | |
| function parseNames(html) { | |
| const doc = new DOMParser().parseFromString(html, "text/html"); | |
| return [...doc.querySelectorAll("td.user-name a[title='View user profile.']")].map((a) => | |
| a.textContent.trim().replace(/\s+/g, " "), | |
| ); | |
| } | |
| console.log(new Set(parseNames(await window.baseFind(1)), parseNames(await window.baseFind(2)), parseNames(await window.baseFind(3)))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment