mirror of
https://cdm-project.com/Download-Tools/udemy-downloader.git
synced 2025-05-02 20:14:26 +02:00
bug fixes
This commit is contained in:
parent
59b6419ade
commit
171f7b7719
25
main.py
25
main.py
@ -860,11 +860,10 @@ def decrypt(kid, in_filepath, out_filepath):
|
|||||||
raise KeyError("Key not found")
|
raise KeyError("Key not found")
|
||||||
|
|
||||||
|
|
||||||
def handle_segments(url, format_id, video_title, chapter_dir,
|
def handle_segments(url, format_id, video_title,
|
||||||
output_path, lecture_file_name, concurrent_connections):
|
output_path, lecture_file_name, concurrent_connections, chapter_dir):
|
||||||
os.chdir(chapter_dir)
|
os.chdir(os.path.join(chapter_dir))
|
||||||
# temp_filepath = output_path.replace("%", "").replace(".mp4", "")
|
file_name = lecture_file_name.replace("%", "").replace(".mp4", "")
|
||||||
file_name = lecture_file_name.replace("%", "").repalce(".mp4", "")
|
|
||||||
video_filepath_enc = file_name + ".mp4"
|
video_filepath_enc = file_name + ".mp4"
|
||||||
audio_filepath_enc = file_name + ".m4a"
|
audio_filepath_enc = file_name + ".m4a"
|
||||||
video_filepath_dec = file_name + ".decrypted.mp4"
|
video_filepath_dec = file_name + ".decrypted.mp4"
|
||||||
@ -1026,8 +1025,8 @@ def process_caption(caption, lecture_title, lecture_dir, keep_vtt, tries=0):
|
|||||||
print(f" > Error converting caption: {e}")
|
print(f" > Error converting caption: {e}")
|
||||||
|
|
||||||
|
|
||||||
def process_lecture(lecture, lecture_path, chapter_dir, lecture_file_name, quality, access_token,
|
def process_lecture(lecture, lecture_path, lecture_file_name, quality, access_token,
|
||||||
concurrent_connections):
|
concurrent_connections, chapter_dir):
|
||||||
lecture_title = lecture.get("lecture_title")
|
lecture_title = lecture.get("lecture_title")
|
||||||
is_encrypted = lecture.get("is_encrypted")
|
is_encrypted = lecture.get("is_encrypted")
|
||||||
lecture_sources = lecture.get("video_sources")
|
lecture_sources = lecture.get("video_sources")
|
||||||
@ -1049,8 +1048,8 @@ def process_lecture(lecture, lecture_path, chapter_dir, lecture_file_name, quali
|
|||||||
lecture_title)
|
lecture_title)
|
||||||
handle_segments(source.get("download_url"),
|
handle_segments(source.get("download_url"),
|
||||||
source.get(
|
source.get(
|
||||||
"format_id"), chapter_dir, lecture_title, lecture_path, lecture_file_name,
|
"format_id"), lecture_title, lecture_path, lecture_file_name,
|
||||||
concurrent_connections)
|
concurrent_connections, chapter_dir)
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
" > Lecture '%s' is already downloaded, skipping..." %
|
" > Lecture '%s' is already downloaded, skipping..." %
|
||||||
@ -1097,8 +1096,8 @@ def process_lecture(lecture, lecture_path, chapter_dir, lecture_file_name, quali
|
|||||||
os.rename(temp_filepath, lecture_path)
|
os.rename(temp_filepath, lecture_path)
|
||||||
print(" > HLS Download success")
|
print(" > HLS Download success")
|
||||||
else:
|
else:
|
||||||
download_aria(url, lecture_dir, lecture_title + ".mp4")
|
download_aria(url, chapter_dir, lecture_title + ".mp4")
|
||||||
except Exception as e:
|
except EnvironmentError as e:
|
||||||
print(f" > Error downloading lecture: ", e)
|
print(f" > Error downloading lecture: ", e)
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
@ -1155,9 +1154,9 @@ def parse_new(_udemy, quality, skip_lectures, dl_assets, dl_captions,
|
|||||||
lecture_path = os.path.join(
|
lecture_path = os.path.join(
|
||||||
chapter_dir,
|
chapter_dir,
|
||||||
lecture_file_name)
|
lecture_file_name)
|
||||||
process_lecture(lecture, lecture_path, lecture_file_name, chapter_dir,
|
process_lecture(lecture, lecture_path, lecture_file_name,
|
||||||
quality, access_token,
|
quality, access_token,
|
||||||
concurrent_connections)
|
concurrent_connections, chapter_dir)
|
||||||
|
|
||||||
if dl_assets:
|
if dl_assets:
|
||||||
assets = lecture.get("assets")
|
assets = lecture.get("assets")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user