Puyodead1 / udemy-downloader

A Udemy downloader that can download courses, with DRM support.
MIT License
1.26k stars 291 forks source link

[Bug]: Subtitles are not downloaded in the latest branch #231

Open Lollinoo opened 1 month ago

Lollinoo commented 1 month ago

What happened?

I tried downloading the same course using the last two versions of the master branch (Before/After refactor branch) and noticed that subtitles are not downloaded in the last update.

Expected Result

Command used: python .\main.py -c CourseURL -b cookie.txt --download-captions --skip-lectures --log-level DEBUG

BEFORE UPDATE:

[12:23:24] [udemy-downloader] [parse_new:1786] INFO: Processing 15 caption(s)... [12:23:24] [udemy-downloader] [process_caption:1566] INFO: > Downloading caption: '001 Introduction_en.vtt'

07/17 00:23:24 [NOTICE] Downloading 1 item(s)

07/17 00:23:24 [NOTICE] Download complete: C:/Users/User/Desktop/udemy-downloader-master-old/out_dir/ccna-complete/01 - Welcome/001 Introduction_en.vtt

Download Results: gid |stat|avg speed |path/URI ======+====+===========+======================================================= e6815a|OK | 426KiB/s|C:/Users/User/Desktop/udemy-downloader-master-old/out_dir/ccna-complete/01 - Welcome/001 Introduction_en.vtt

Status Legend: (OK):download completed. [12:23:24] [udemy-downloader] [process_caption:1569] DEBUG: > Download return code: 0 [12:23:24] [udemy-downloader] [process_caption:1579] INFO: > Converting caption to SRT format... [12:23:24] [udemy-downloader] [process_caption:1581] INFO: > Caption conversion complete.


AFTER UPDATE:

[12:38:57] [udemy-downloader] [parse_new:1658] INFO: ======= Processing chapter 1 of 320======= [12:39:00] [udemy-downloader] [parse_new:1710] INFO: Processing 0 caption(s)... [12:39:04] [udemy-downloader] [parse_new:1710] INFO: Processing 0 caption(s)... [12:39:04] [udemy-downloader] [parse_new:1710] INFO: Processing 0 caption(s)... [12:39:05] [udemy-downloader] [parse_new:1710] INFO: Processing 0 caption(s)... [12:39:08] [udemy-downloader] [parse_new:1710] INFO: Processing 0 caption(s)...

Branch

master/main

What operating systems are you seeing the problem on?

Windows

Relevant log output

No response

Other information

No response

Puyodead1 commented 1 month ago

this is intentional, there was an issue where trying to get subtitles from the udemy API caused udemy to return http errors. I haven't checked if udemy fixed it, but you can try it by changing COURSE_URL in constants.py to COURSE_URL = "https://{portal_name}.udemy.com/api-2.0/courses/{course_id}/subscriber-curriculum-items/?page_size=100&fields[asset]=asset_type,length,captions,media_license_token,course_is_drmed,media_sources,thumbnail_sprite,slides,slide_urls,filename,download_urls,external_url,stream_urls&fields[chapter]=object_index,title&fields[lecture]=id,title,object_index,asset,supplementary_assets,view_html&caching_intent=True"

Lollinoo commented 1 month ago

upstream connect error or disconnect/reset before headers. reset reason: connection termination

One workaround I am trying to work on is storing the “LectureIDs” and placing them within this new url:

LECTURE_URL = “https://{portal_name}.udemy.com/api-2.0/users/me/subscribed-courses/{course_id}/lectures/{lecture_id}/?fields[lecture]=asset,description,download_url&fields[asset]=asset_type,length,media_license_token,course_is_drmed,media_sources,captions,thumbnail_sprite,slides,slide_urls,download_urls,external_url”

Only from this api you can get the url of the subtitles, but this will greatly complicate the flow of the program

Puyodead1 commented 1 month ago

upstream connect error or disconnect/reset before headers. reset reason: connection termination

One workaround I am trying to work on is storing the “LectureIDs” and placing them within this new url:

LECTURE_URL = “https://{portal_name}.udemy.com/api-2.0/users/me/subscribed-courses/{course_id}/lectures/{lecture_id}/?fields[lecture]=asset,description,download_url&fields[asset]=asset_type,length,media_license_token,course_is_drmed,media_sources,captions,thumbnail_sprite,slides,slide_urls,download_urls,external_url”

Only from this api you can get the url of the subtitles, but this will greatly complicate the flow of the program

That's just not feasible

Muhammed-Osamaa commented 4 weeks ago

i have the same issue

Puyodead1 commented 1 week ago

This issue may be fixed in 2d6a3020aab0612630fd650587c05b5d89b0892c, they seem to be downloading fine for me in a course with 182 lectures.