The GitIrDownloader class is responsible for downloading lessons from a website called git.ir. It sets up the download path, retrieves the course URLs, and downloads the lessons.
The main functionalities of the GitIrDownloader class are:
- Setting up the download path for the lessons.
- Retrieving the course URLs.
- Downloading the lessons.
The GitIrDownloader class has the following methods:
__post_init__(): Initializes the class and calls thepre_download()method.setup_download_path(course_name): Sets up the download path for the lessons based on the course name.pre_download(): Calls theraw_course_handler()anddownload()methods.get_lesson(url): Retrieves the lesson information (course name and lesson name) from the given URL.get_course_name(url): Extracts the course name from the given URL.download(): Downloads the lessons by iterating over the course URLs and calling theget_lesson()method for each URL.get_raw_courses(): Reads the raw courses from a file and returns them as a list.get_course_urls(): Reads the course URLs from a JSON file and returns them.raw_course_handler(): Handles the raw courses by calling theget_raw_courses()method and writing the courses to a JSON file.
The GitIrDownloader class has the following field:
download_path: The path where the downloaded lessons will be saved.
-
open the git.ir course download page
-
click on "copy all to clipboard"
-
paste the content into "raw_courses" file
-
run
python main.py