def course_download(
        self,
        path="",
        quality="",
        language="en",
        dl_assets=True,
        dl_lecture=True,
        dl_subtitles=True,
        chapter_number=None,
        chapter_start=None,
        chapter_end=None,
        lecture_number=None,
        lecture_start=None,
        lecture_end=None,
        keep_vtt=False,
        skip_hls_stream=False,
    ):
        """This function will download the course contents .."""
        if not self.cookies:
            logger.info(msg="Trying to login as", status=self.username)
        if self.cookies:
            logger.info(msg="Trying to login using session cookie", new_line=True)
        for url in self.url_or_courses:
            course = udemy.course(
                url=url,
                username=self.username,
                password=self.password,
                cookies=self.cookies,
                skip_hls_stream=skip_hls_stream,
                cache_session=self._cache_session,
            )
            course_name = course.title
            if path:
                if "~" in path:
                    path = os.path.expanduser(path)
            course_path = os.path.join(path, course_name)
            chapters = course.get_chapters(
                chapter_number=chapter_number,
                chapter_start=chapter_start,
                chapter_end=chapter_end,
            )
            total_lectures = course.lectures
            total_chapters = course.chapters
            logger.success(msg=course_name, course=True)
            logger.info(msg=f"Chapter(s) ({total_chapters})", new_line=True)
            logger.info(msg=f"Lecture(s) ({total_lectures})", new_line=True)
            for chapter in chapters:
                chapter_index = chapter.index
                chapter_title = chapter.title
                lectures = chapter.get_lectures(
                    lecture_number=lecture_number,
                    lecture_start=lecture_start,
                    lecture_end=lecture_end,
                )
                lectures_count = chapter.lectures
                filepath = to_filepath(course_path, chapter_title)
                logger.set_log_filepath(course_path)
                chapter_progress = (
                    chapter_index
                    if chapter_number
                    else f"{chapter_index} of {total_chapters}"
                )
                logger.info(
                    msg=f"Downloading chapter : ({chapter_progress})",
                    new_line=True,
                    before=True,
                    cc=80,
                    cc_msg=80,
                )
                logger.info(
                    msg=f"Chapter ({chapter_title})", new_line=True, cc=15, cc_msg=60
                )
                logger.info(
                    msg=f"Found ({lectures_count}) lecture(s).",
                    new_line=True,
                )
                lecture_index = 0
                if lecture_number:
                    lecture_index = lecture_number - 1
                if lecture_start:
                    lecture_index = lecture_start - 1
                if lecture_index < 0:
                    lecture_index = 0
                for lecture in lectures:
                    lecture_assets = lecture.assets
                    lecture_subtitles = lecture.subtitles
                    lecture_best = lecture.getbest()
                    if dl_lecture:
                        lecture_index = lecture_index + 1
                        if lecture.html:
                            retval = lecture.dump(filepath=filepath)
                            msg = retval.get("msg")
                            if msg not in ["download", "already downloaded"]:
                                msg = f"Lecture: '{lecture.title}.{lecture.extension}' failed to dump, reason: {msg}"
                                logger.warning(msg=msg, silent=True)
                        self.download_lecture(
                            lecture_best,
                            filepath,
                            lecture_index,
                            lectures_count,
                            quality,
                        )
                    if dl_assets:
                        self.download_assets(lecture_assets, filepath)
                    if dl_subtitles:
                        self.download_subtitles(
                            lecture_subtitles,
                            filepath,
                            language=language,
                            keep_vtt=keep_vtt,
                        )
            print("")
This function will download the course contents ..
udemy-dl.py