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