question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Udemy] ERROR: Unable to download webpage: HTTP Error 403: Forbidden

See original GitHub issue

Checklist

  • I’m reporting a broken site support
  • I’ve verified that I’m running youtube-dl version 2021.06.06
  • 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:\>youtube-dl.exe -u **** -p **** https://www.udemy.com/course/learn-advanced-java/ --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-u', 'PRIVATE', '-p', 'PRIVATE', 'https://www.udemy.com/course/learn-advanced-java/', '--verbose']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.18362
[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 "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\common.py", line 634, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\YoutubeDL.py", line 2288, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 470, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 580, in http_response
  File "C:\Python\Python34\lib\urllib\request.py", line 508, in error
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_default```

Description

I was trying to download the learn advanced Java course which I have bought from Udemy for offline watching purposes. However, youtube-dl gives me an error when trying to do so.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:33 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
zdegeorgecommented, Dec 23, 2021

I was having the 403 issue, and then I was having an extract login-form form issue, but I was able to resolve both of them and get youtube-dl working with Udemy.

First I was able to resolve the 403 by logging into the website in chrome and then downloading the cookie file and including it with the ‘–cookie /path/to/cookie.txt’ option. (See How do I pass cookies to youtube-dl). But then I was still getting the error:

ERROR: Unable to extract login-form form; 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.

It turns out this was caused because in my youtube-dl request I was passing -u username -p password options to the request which was causing the login popup preventing the download.

Also to note, in the URL for a course in Udemy, i.e. https://www.udemy.com/course/understanding-typescript/, there is an extra /course/ that needs to be removed for the request. So the URL should instead look like https://www.udemy.com/understanding-typescript/.

Put all this together and a valid request should look like:

youtube-dl --cookie /path/to/cookies.txt -o '~/your/path/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/COURSE-NAME/

Where you replace the path to the cookie file, the path to the output directory, and the course name in the Udemy URL.

Hope this helps 😃

1reaction
nicheathcommented, Mar 8, 2022

What’s wrong?

youtube-dl 2021.12.17 still has a problem using -u and -p

note

however using --cookies is a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Udemy.com HTTP Error 403: Forbidden (caused by ... - GitHub
The download will not work, because the course is not downloadable from the browser. You can check the api calls and search for...
Read more >
HTTP Error 403: Forbidden in youtube-dl - Stack Overflow
It's a known issue. There's no fix for it at this time. Udemy changed how their cookies and session-id's are handled.
Read more >
Unable to download webpage: HTTP Error 403 - Reddit
Unable to download webpage : HTTP Error 403: Forbidden (caused by HTTPError()). Hello everyone, I'm trying to download an Udemy course but I ......
Read more >
HTTP Error 403 Forbidden Messages: What They Are & How ...
An easy way to remember it: 403 says "access denied" while 404 says "We can't find what you asked for." What causes a...
Read more >
HTTP 403 Forbidden | What is 403 Forbidden Error and How ...
Clear Your Browser's Cookies : This is especially necessary if you log into the website but your last attempt was unsuccessful. However, ensure ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found