ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.66k stars 9.97k forks source link

udemy videos cannot download (login page) #30714

Closed ayushs089 closed 2 years ago

ayushs089 commented 2 years ago

youtube-dl -u -p -o '/root/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/course/aws-certified-solutions-architect-associate-saa-c02/learn/lecture/13528014 --verbose [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'-o', u'/root/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s', u'https://www.udemy.com/course/aws-certified-solutions-architect-associate-saa-c02/learn/lecture/13528014#learning-tools', u'--verbose'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2021.12.17 [debug] Python version 2.7.5 (CPython) - Linux-3.10.0-327.el7.x86_64-x86_64-with-redhat-7.2-Maipo [debug] exe versions: none [debug] Proxy map: {} [udemy:course] Downloading login popup ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by HTTPError()); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 634, in _request_webpage return self._downloader.urlopen(url_or_request) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2288, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/usr/lib64/python2.7/urllib2.py", line 437, in open response = meth(req, response) File "/usr/lib64/python2.7/urllib2.py", line 550, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python2.7/urllib2.py", line 475, in error return self._call_chain(args) File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain result = func(args) File "/usr/lib64/python2.7/urllib2.py", line 558, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

dirkf commented 2 years ago

Duplicate of #29410. See also #29705, #22306.

ku-dmitry commented 2 years ago

403 can be fixed if you use cookies from browser instead of giving plain credentials and make URL look like https://www.udemy.com/aws-certified-solutions-architect-associate-saa-c02/ by removing /course/ part.

After that youtube-dl stumbles upon youtube_dl.utils.RegexNotFoundError: Unable to extract course id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

amitfegade121 commented 2 years ago

403 can be fixed if you use cookies from browser instead of giving plain credentials and make URL look like https://www.udemy.com/aws-certified-solutions-architect-associate-saa-c02/ by removing /course/ part.

After that youtube-dl stumbles upon youtube_dl.utils.RegexNotFoundError: Unable to extract course id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Hi ku-dmitry... cookies method is still showing 403 forbidden error.

ku-dmitry commented 2 years ago

I'll need the initial command and output to try to find out what's wrong

amitfegade121 commented 2 years ago

I'll need the initial command and output to try to find out what's wrong

youtube-dl --cookies cookies.txt --verbose https://www.udemy.com/learn-jmeter-from-scratch-performance-load-testing-tool/learn/lecture/12926938#overview [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['--cookies', 'cookies.txt', '--verbose', 'https://www.udemy.com/learn-jmeter-from-scratch-performance-load-testing-tool/learn/lecture/12926938#overview'] [debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252 [debug] youtube-dl version 2021.12.17 [debug] Python version 3.9.2 (CPython) - Windows-10-10.0.19041-SP0 [debug] exe versions: ffmpeg git-2020-05-01-39fb1e9 [debug] Proxy map: {} [udemy:course] learn-jmeter-from-scratch-performance-load-testing-tool: Downloading webpage ERROR: Unable to download webpage: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\extractor\common.py", line 634, in _request_webpage return self._downloader.urlopen(url_or_request) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2288, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open response = meth(req, response) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response response = self.parent.error( File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 555, in error result = self._call_chain(args) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain result = func(args) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 747, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open response = meth(req, response) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response response = self.parent.error( File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error return self._call_chain(args) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain result = func(args) File "C:\Users\amitf\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 641, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp)

amitfegade121 commented 2 years ago

I'll need the initial command and output to try to find out what's wrong

I have used Get cookies.txt chrome extension to export cookies and kept that file in the current directory from where I am running a command.

dirkf commented 2 years ago

After that youtube-dl stumbles upon youtube_dl.utils.RegexNotFoundError: Unable to extract course id; ...

See #30719.

amitfegade121 commented 2 years ago

I'll need the initial command and output to try to find out what's wrong

I can share my credentials as well if you want.

ku-dmitry commented 2 years ago

403 most likely refers to the fact that the script was unable to login. Try grabbing cookies some other way or you may want to try out a youtube-dl's fork which automatically extracts cookies from browser.

Whichever option you stick with - you'll need to manually apply #30719 in order to grab videos. It works for me. But for some courses it struggles to find a majority of videos.

amitfegade121 commented 2 years ago

Sure... Thank you for your quick response. I will give it a try and let you know...

dirkf commented 2 years ago

403 can be fixed if you ... make URL look like https://www.udemy.com/aws-certified-solutions-architect-associate-saa-c02/ by removing /course/ part.

This seems to be because modifying the URL causes it to be redirected to the original URL, in the process generating whatever headers are required to avoid 403 on the original URL.