mirror of
https://cdm-project.com/Download-Tools/udemy-downloader.git
synced 2025-04-30 02:34:25 +02:00
Fix: course directory not being created
This commit is contained in:
parent
e383ca945d
commit
c88414189b
11
main.py
11
main.py
@ -459,6 +459,9 @@ def process_lecture(lecture, lecture_index, lecture_path, lecture_dir):
|
||||
|
||||
|
||||
def parse(data):
|
||||
course_dir = f"%s\\%s" % (download_dir, course_id)
|
||||
if not os.path.exists(course_dir):
|
||||
os.mkdir(course_dir)
|
||||
chapters = []
|
||||
lectures = []
|
||||
|
||||
@ -474,13 +477,13 @@ def parse(data):
|
||||
# This is caused by there not being a starting chapter
|
||||
lectures.append(obj)
|
||||
lecture_index = lectures.index(obj) + 1
|
||||
lecture_path = f"%s\\%s\\%s. %s.mp4" % (
|
||||
download_dir, course_id, lecture_index, sanitize(obj["title"]))
|
||||
lecture_path = f"%s\\%s. %s.mp4" % (course_dir, lecture_index,
|
||||
sanitize(obj["title"]))
|
||||
process_lecture(obj, lecture_index, lecture_path, download_dir)
|
||||
|
||||
for chapter in chapters:
|
||||
chapter_dir = f"%s\\%s\\%s. %s" % (download_dir, course_id, chapters.index(chapter) +
|
||||
1, sanitize(chapter["title"]))
|
||||
chapter_dir = f"%s\\%s. %s" % (course_dir, chapters.index(chapter) + 1,
|
||||
sanitize(chapter["title"]))
|
||||
if not os.path.exists(chapter_dir):
|
||||
os.mkdir(chapter_dir)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user