2025-05-24 12:15:48 +02:00

30 lines
1.0 KiB
Python

"""
URLs used by the scraper.
Functions marked as PUBLIC can be accessed without authentication.
Functions marked as PRIVATE require authentication.
"""
BASE_URL = "https://moodle.fhgr.ch"
CRAWLER = {
"DELAY_SLOW": 2.0,
"DELAY_FAST": 0.5,
"BATCH_SLOW": 2,
"BATCH_FAST": 8,
}
class PUBLIC_URLS:
base_url = BASE_URL
login = f"{BASE_URL}/login/index.php"
index = f"{BASE_URL}/course/index.php"
degree_program = lambda degree_program_id: f"{BASE_URL}/course/index.php?categoryid={degree_program_id}"
category = lambda category_id: f"{BASE_URL}/course/index.php?categoryid={category_id}"
term = lambda term_id: f"{BASE_URL}/course/index.php?categoryid={term_id}"
class PRIVATE_URLS:
user_courses = f"{BASE_URL}/my/courses.php"
dashboard = f"{BASE_URL}/my/"
course = lambda course_id: f"{BASE_URL}/course/view.php?id={course_id}"
files = lambda context_id: f"{BASE_URL}/course/downloadcontent.php?contextid={context_id}"
file = lambda file_id: f"{BASE_URL}/mod/resource/view.php?id={file_id}"