Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Udemy.com HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>) #22705

Open
vikiaiteam opened this issue Oct 14, 2019 · 26 comments
Open

Comments

@vikiaiteam
Copy link

@vikiaiteam vikiaiteam commented Oct 14, 2019

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2019.09.28
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones

Verbose log

 C:\udemy-downloaded>youtube-dl -v -u xxx@gmail.com -p xxx --cookies C:\udemy-downloaded\udemy-cookies.txt -o "C:\udemy-downloaded\%(
playlist)s/%(chapter_number)s-%(chapter)s/%(playlist_index)s.%(title)s.%(ext)s" https://www.udemy.com/course/academic-ielts-writing-task-1 
s
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-u', 'PRIVATE', '-p', 'PRIVATE', '--cookies', 'C:\\udemy-downloaded\\udemy-cookies.txt', '-o', 'C:\\udemy-downloaded\\%(pl
aylist)s/%(chapter_number)s-%(chapter)s/%(playlist_index)s.%(title)s.%(ext)s', 'https://www.udemy.com/course/academic-ielts-writing-task-1', '--convert-subs', 'vtt']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2019.09.28
[debug] Python version 3.7.4 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-93640-ga087764847, ffprobe N-93640-ga087764847
[debug] Proxy map: {}
[udemy:course] Downloading login popup
[udemy:course] course: Downloading webpage
[udemy:course] 2205064: Downloading course curriculum
[download] Downloading playlist: 2205064
[udemy:course] playlist 2205064: Collected 43 video ids (downloading 43 of them)
[download] Downloading video 1 of 43
[udemy] Downloading login popup
[udemy] 13580764: Downloading webpage
[udemy] 13580764: Downloading lecture JSON
[udemy] 13580764: Downloading lecture JSON
ERROR: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on https://yt-dl.org/bug . Make sure you ar
e 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:\python37\lib\site-packages\youtube_dl\extractor\common.py", line 627, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "c:\python37\lib\site-packages\youtube_dl\YoutubeDL.py", line 2237, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "c:\python37\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "c:\python37\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\python37\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "c:\python37\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "c:\python37\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)```


## Description

<!--
Provide an explanation of your issue in an arbitrary form. Provide any additional information, suggested solution and as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

WRITE DESCRIPTION HERE
@luizconrado
Copy link

@luizconrado luizconrado commented Oct 16, 2019

I have the exact same problem. Do we have any news about this bug?

@jeaye
Copy link

@jeaye jeaye commented Oct 28, 2019

This has been reported many times, but I haven't yet seen any info on it. I've tried with a cookies.txt file and also with manually specifying -u and -p. The cookies file gets further, as shown in the logs above, but only as far as seeing all of the videos to download. Once it tries downloading the first video, the 403 shows up again.

@Shineson1001
Copy link

@Shineson1001 Shineson1001 commented Oct 28, 2019

I have the same problem for many days.
In the Meanwhile i use udemy-dl (in a docker container). It works fine.

@mabdelghaniML
Copy link

@mabdelghaniML mabdelghaniML commented Nov 3, 2019

I experienced the same issue from Git-bash and from the windows version.
Any help or updates?

@Darkcast
Copy link

@Darkcast Darkcast commented Nov 6, 2019

I have the same problem for many days.
In the Meanwhile i use udemy-dl (in a docker container). It works fine.

That tool is also broken it doesnt download the videos either

@Shineson1001
Copy link

@Shineson1001 Shineson1001 commented Nov 6, 2019

I have the same problem for many days.
In the Meanwhile i use udemy-dl (in a docker container). It works fine.

That tool is also broken it doesnt download the videos either

it works

root@nuc1:/opt/docker-udemydl # cat Dockerfile
FROM python:alpine

RUN apk add --no-cache --update gcc libc-dev libffi-dev openssl-dev git &&
git clone https://github.com/r0oth3x49/udemy-dl.git &&
cd udemy-dl &&
pip install -r requirements.txt &&
mkdir -p /course

VOLUME ["/course"]

ENTRYPOINT ["python", "/udemy-dl/udemy-dl.py", "-o", "/course"]

docker build -t xxx/your-udemy-dl-image:1.0 . --no-cache
docker run -it --rm -v $(pwd):/course --name tempudemy-dl xxx/your-udemy-dl-image:1.0 -u your-udemy-user -p your-udemy-password https://www.udemy.com/course/xxx

@davidhenley
Copy link

@davidhenley davidhenley commented Dec 10, 2019

@Darkcast it works just fine with the instructions in the repo

@MPW1412
Copy link

@MPW1412 MPW1412 commented Dec 13, 2019

403 looks like a missmatch in the Metadata. Which data does the udemy-dl script use?

@pavelloz
Copy link

@pavelloz pavelloz commented Jan 26, 2020

I tried to use gist instructions described here: https://gist.github.com/barbietunnie/8531d9c26cd1c0668e7278c7c4ba5853

But without success.

Heres what i got on current youtube-dl:

Downloads|⇒ youtube-dl --cookies cookie.txt https://www.udemy.com/course/hacking-real-websites-legally-2 --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--cookies', u'cookie.txt', u'https://www.udemy.com/course/hacking-real-websites-legally-2', u'--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.01.24
[debug] Python version 2.7.17 (CPython) - Darwin-18.7.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4
[debug] Proxy map: {}
[udemy:course] course: Downloading webpage
[udemy:course] 2664834: Downloading course curriculum
[download] Downloading playlist: 2664834
[udemy:course] playlist 2664834: Collected 28 video ids (downloading 28 of them)
[download] Downloading video 1 of 28
[udemy] 17022386: Downloading webpage
[udemy] 17022386: Downloading lecture JSON
[udemy] 17022386: Downloading lecture JSON
ERROR: Unable to download JSON metadata: 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 627, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2237, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
@pavelloz

This comment was marked as off-topic.

@jose1711
Copy link

@jose1711 jose1711 commented Apr 2, 2020

Same here, it dies in exactly same spot everytime I run it:

..
[download] Destination: 30318/3.03. Javascript Essentials/14.0303 Boolean Types And Comparison.mp4
[download] 100% of 3.05MiB in 00:00
[download] Downloading video 15 of 92
[udemy] 170627: Downloading webpage
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.
@petr-hybler
Copy link

@petr-hybler petr-hybler commented Apr 3, 2020

Hello guys same here ... any update? It would be helpful to fix it so we can watch those courses offline

OS: Linux

youtube-dl -u #myUsername# -p #MyPassword# https://udemy.com/course/the-ultimate-drawing-course-beginner-to-advanced/ --verbose [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'https://udemy.com/course/the-ultimate-drawing-course-beginner-to-advanced/', u'--verbose'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2020.03.24 [debug] Python version 2.7.17 (CPython) - Linux-5.3.0-45-generic-x86_64-with-Ubuntu-18.04-bionic [debug] exe versions: ffmpeg 3.4.6, ffprobe 3.4.6, phantomjs 2.1.1, rtmpdump 2.4 [debug] Proxy map: {} [udemy:course] Downloading login popup [udemy:course] Logging in [udemy:course] course: Downloading webpage [udemy:course] 874012: Enrolling in the course [udemy:course] 874012: Downloading course curriculum ERROR: Unable to download JSON metadata: 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; 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 "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 627, in _request_webpage return self._downloader.urlopen(url_or_request) File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 2238, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/usr/lib/python2.7/urllib2.py", line 435, in open response = meth(req, response) File "/usr/lib/python2.7/urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib/python2.7/urllib2.py", line 473, in error return self._call_chain(*args) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

@sebastianhritcu
Copy link

@sebastianhritcu sebastianhritcu commented Apr 21, 2020

Hi all,

The download will not work, because the course is not downloadable from the browser. You can check the api calls and search for "download_urls:" and you will see the value is set to null.

Maybe checking for the parameter from the api calls for "stream_urls:" and than try to download the video file.

api call example:
{
"stream_urls":
{
"Video":
[
{
"type":"video/mp4",
"label":"720",
"file":"https://bla bla bla with no extension"
}
]
}
}

@darkRaspberry
Copy link

@darkRaspberry darkRaspberry commented Apr 24, 2020

I also have this error

@jadence
Copy link

@jadence jadence commented May 19, 2020

I was having the same 403 error despite purchasing the course. To fix it I did two things:

  1. Clear my udemy cookies, log back into udemy.com, and then export a new cookies.txt
  2. Changed the course URL from https://www.udemy.com/course/<course_name>/ to https://www.udemy.com/<course_name>/

After the above two steps running youtube-dl --cookies cookies.txt https://www.udemy.com/<course_name>/ --verbose finally worked!

@petr-hybler
Copy link

@petr-hybler petr-hybler commented May 20, 2020

sorry ... even that does not work :(

@Shineson1001
Copy link

@Shineson1001 Shineson1001 commented May 20, 2020

hi @jadence,
thanks, it works.

@nbensa
Copy link

@nbensa nbensa commented May 21, 2020

  1. Changed the course URL from https://www.udemy.com/course/<course_name>/ to https://www.udemy.com/<course_name>/

This fixed it for me. I downloaded all the videos for the course I bought.

Thanks @jadence

@Anil86
Copy link

@Anil86 Anil86 commented Jun 11, 2020

@jadence , @nbensa Can you share your full youtube-dl's command syntax?

@nbensa
Copy link

@nbensa nbensa commented Jun 11, 2020

@Anil86

youtube-dl --cookies [path-to-cookies-file] https://www.udemy.com/<course-name>/

HTH

@Anil86
Copy link

@Anil86 Anil86 commented Jun 11, 2020

I tried to generate cookie file using EditThisCookie chrome extension. But it shows following error:

'cookies.txt' does not look like a Netscape format cookies file.

@nbensa What tool are you using to export cookie file?

@jadence
Copy link

@jadence jadence commented Jun 11, 2020

@jadence , @nbensa Can you share your full youtube-dl's command syntax?

@Anil86 - My command I used is youtube-dl --cookies cookies.txt https://www.udemy.com/<course_name>/ --verbose
notes:
• The --verbose flag almost certainly isn't necessary
• My cookies.txt was placed in the same directory I ran the above command in
• My cookies.txt file was generated using https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/

Good luck!

@petr-hybler
Copy link

@petr-hybler petr-hybler commented Jun 13, 2020

guys what os and version of youtube-dl are you running ??

My system
Ubuntu: 20.04 LTS
Gnome: 3.36.2
youtube-dl: 2020-06-06

and your way simply does not work.. always returns 403 :(

plus can you list down your python version and packages installed? might be something related to that as well

@petr-hybler
Copy link

@petr-hybler petr-hybler commented Jun 13, 2020

holly crap it works now .. yes ... I uninstalled and reinstalled python and pip and it works now ...

@khanu
Copy link

@khanu khanu commented Jun 24, 2020

I was having the same 403 error despite purchasing the course. To fix it I did two things:

1. Clear my udemy cookies, log back into udemy.com, and then export a new `cookies.txt`

2. Changed the course URL from `https://www.udemy.com/course/<course_name>/` to `https://www.udemy.com/<course_name>/`

After the above two steps running youtube-dl --cookies cookies.txt https://www.udemy.com/<course_name>/ --verbose finally worked!

This 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.