29 lines
654 B
Python
29 lines
654 B
Python
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
# CANVAS_URL = "https://canvas.auckland.ac.nz"
|
|
COURSE_ID = "61920"
|
|
CANVAS_URL = "https://canvas.auckland.ac.nz"
|
|
|
|
def read_cookie():
|
|
with open("cookie.txt", "r") as file:
|
|
cookie = file.read().strip()
|
|
return cookie
|
|
|
|
def main():
|
|
cookie = read_cookie()
|
|
|
|
r = requests.get(
|
|
url=f"{CANVAS_URL}/courses/{COURSE_ID}/modules",
|
|
headers={
|
|
"Cookie": cookie,
|
|
})
|
|
|
|
soup = BeautifulSoup(r.text, "html.parser")
|
|
|
|
links = soup.findAll("a", {"class": "ig-title title item_link"})
|
|
print(links)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|