mirror of
https://cdm-project.com/Download-Tools/udemy-downloader.git
synced 2025-04-30 17:34:25 +02:00
Fix downloaded files missing file extensions
This commit is contained in:
parent
d20f15fb6a
commit
354b85e142
9
main.py
9
main.py
@ -904,7 +904,8 @@ def process_caption(caption, lecture_title, lecture_dir, keep_vtt, tries=0):
|
|||||||
else:
|
else:
|
||||||
print(f"> Downloading caption: '%s'" % filename)
|
print(f"> Downloading caption: '%s'" % filename)
|
||||||
try:
|
try:
|
||||||
download_aria(caption.get("download_url"), lecture_dir, filename)
|
download_aria(caption.get("download_url"), lecture_dir,
|
||||||
|
filename + caption.get("extension"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if tries >= 3:
|
if tries >= 3:
|
||||||
print(
|
print(
|
||||||
@ -984,7 +985,7 @@ def process_lecture(lecture, lecture_path, lecture_dir, quality, access_token):
|
|||||||
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)
|
download_aria(url, lecture_dir, lecture_title + ".mp4")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"> Error downloading lecture: ", e)
|
print(f"> Error downloading lecture: ", e)
|
||||||
else:
|
else:
|
||||||
@ -1050,6 +1051,7 @@ def parse_new(_udemy, quality, skip_lectures, dl_assets, dl_captions,
|
|||||||
asset_type = asset.get("type")
|
asset_type = asset.get("type")
|
||||||
filename = asset.get("filename")
|
filename = asset.get("filename")
|
||||||
download_url = asset.get("download_url")
|
download_url = asset.get("download_url")
|
||||||
|
ext = asset.get("extension")
|
||||||
|
|
||||||
if asset_type == "article":
|
if asset_type == "article":
|
||||||
print(
|
print(
|
||||||
@ -1073,7 +1075,8 @@ def parse_new(_udemy, quality, skip_lectures, dl_assets, dl_captions,
|
|||||||
print("AssetType: Video; AssetData: ", asset)
|
print("AssetType: Video; AssetData: ", asset)
|
||||||
elif asset_type == "audio" or asset_type == "e-book" or asset_type == "file" or asset_type == "presentation":
|
elif asset_type == "audio" or asset_type == "e-book" or asset_type == "file" or asset_type == "presentation":
|
||||||
try:
|
try:
|
||||||
download_aria(download_url, chapter_dir, filename)
|
download_aria(download_url, chapter_dir,
|
||||||
|
filename + ext)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("> Error downloading asset: ", e)
|
print("> Error downloading asset: ", e)
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user