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] Course download does not work on some courses and returns 403 forbidden after passing the publically available preview videos

See original GitHub issue

Checklist

  • I’m reporting a broken site support
  • I’ve verified that I’m running youtube-dl version 2021.04.26
  • 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

user1@user1 udemy-dl % youtube-dl --cookies /Users/user1/Downloads/udemy.com_cookies.txt -f 'best'  https://www.udemy.com/neo4j-foundations/ -o '%(playlist)s/%(chapter_number)s. %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--cookies', '/Users/user1/Downloads/udemy.com_cookies.txt', '-f', 'best', 'https://www.udemy.com/neo4j-foundations/', '-o', '%(playlist)s/%(chapter_number)s. %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.04.26
[debug] Python version 3.9.4 (CPython) - macOS-10.15.7-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4
[debug] Proxy map: {}
[udemy:course] neo4j-foundations: Downloading webpage
[udemy:course] 692416: Downloading course curriculum
[download] Downloading playlist: 692416
[udemy:course] playlist 692416: Collected 76 video ids (downloading 76 of them)
[download] Downloading video 1 of 76
[udemy] 18178652: Downloading webpage
[udemy] 18178652: Downloading lecture JSON
[udemy] 22522866: Downloading m3u8 information
[debug] Invoking downloader on 'https://www.udemy.com/assets/22522866/files/2020-02-25_04-32-21-c81c9df6373bae728c6ad4e11306017d/1/hls/AVC_1920x1080_1200k_AAC-HE_64k/aa00837488289822bc8bd10f1e3dc6acf0d2.m3u8?provider=verizon&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXRoIjoiMjAyMC0wMi0yNV8wNC0zMi0yMS1jODFjOWRmNjM3M2JhZTcyOGM2YWQ0ZTExMzA2MDE3ZC8xLyIsImV4cCI6MTYxOTQ0Njk0Nn0.UH34mMtW_dNuh8HKBnbVxTbMtn5sppAPPKuPkuYaC3Y&v=1'
[download] 692416/1. Welcome to the course/01. Welcome.mp4 has already been downloaded
[download] 100% of 8.51MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:692416/1. Welcome to the course/01. Welcome.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "692416/1. Welcome to the course/01. Welcome.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:692416/1. Welcome to the course/01. Welcome.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:692416/1. Welcome to the course/01. Welcome.temp.mp4'
[download] Downloading video 2 of 76
[udemy] 4156842: Downloading webpage
[udemy] 4156842: Downloading lecture JSON
[udemy] 22655032: Downloading m3u8 information
[debug] Invoking downloader on 'https://www.udemy.com/assets/22655032/files/2020-03-04_02-05-12-212aaaffa14f70b3af7a7f4a0a94da61/1/hls/AVC_1920x1080_1200k_AAC-HE_64k/aa00b174d6874f6fb5231f5d7250de8d6670.m3u8?provider=verizon&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTk0NDY5NDksInBhdGgiOiIyMDIwLTAzLTA0XzAyLTA1LTEyLTIxMmFhYWZmYTE0ZjcwYjNhZjdhN2Y0YTBhOTRkYTYxLzEvIn0.Mna27tzeyEYSbQOO1qAHyCTaA9glYXf2tNjq4KRrQMo&v=1'
[download] 692416/1. Welcome to the course/02. Course Overview.mp4 has already been downloaded
[download] 100% of 13.86MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:692416/1. Welcome to the course/02. Course Overview.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "692416/1. Welcome to the course/02. Course Overview.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:692416/1. Welcome to the course/02. Course Overview.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:692416/1. Welcome to the course/02. Course Overview.temp.mp4'
[download] Downloading video 3 of 76
[udemy] 4156846: Downloading webpage
[udemy] 4156846: Downloading lecture JSON
[udemy] 22519730: Downloading m3u8 information
[debug] Invoking downloader on 'https://www.udemy.com/assets/22519730/files/2020-02-24_23-53-23-a806ae0cd151554115ac5ffe7dec1a41/1/hls/AVC_1920x1080_800k_AAC-HE_64k/aa000afee21e6278b65683de1eac381e8d83.m3u8?provider=verizon&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiMjAyMC0wMi0yNF8yMy01My0yMy1hODA2YWUwY2QxNTE1NTQxMTVhYzVmZmU3ZGVjMWE0MS8xLyIsImV4cCI6MTYxOTQ0Njk1Mn0.pi7JvnpYLfxgK4KtsMYyT3tzLRhw9bFuTkZHpgw8u78&v=1'
[download] 692416/1. Welcome to the course/03. What is a Graph.mp4 has already been downloaded
[download] 100% of 9.75MiB
[debug] ffmpeg command line: ffprobe -show_streams 'file:692416/1. Welcome to the course/03. What is a Graph.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "692416/1. Welcome to the course/03. What is a Graph.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:692416/1. Welcome to the course/03. What is a Graph.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:692416/1. Welcome to the course/03. What is a Graph.temp.mp4'
[download] Downloading video 4 of 76
[udemy] 5160978: Downloading webpage
[udemy] 5160978: Downloading lecture JSON
[debug] Invoking downloader on 'https://knowband-asset-bucket.s3.amazonaws.com/2020-02-24_23-14-43-4b84b17b8a746b328e2861e663d5a32c/WebHD_720p.mp4'
ERROR: unable to download video data: HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1967, in process_info
    success = dl(filename, info_dict)
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1906, in dl
    return fd.download(name, info)
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/downloader/http.py", line 351, in real_download
    establish_connection()
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/downloader/http.py", line 116, in establish_connection
    raise err
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/downloader/http.py", line 110, in establish_connection
    ctx.data = self.ydl.urlopen(request)
  File "/usr/local/Cellar/youtube-dl/2021.4.26/libexec/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 2279, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Description

When trying to downloading some courses from Udemy, the downloads do not proceed passed the publically available previews.

I have tried these two and it did not work: https://www.udemy.com/course/neo4j-foundations/ https://www.udemy.com/course/the-ultimate-mysql-bootcamp-go-from-sql-beginner-to-expert/

Note the URL that the content is being pulled from differs between the working and non working URLS

[debug] Invoking downloader on 'https://www.udemy.com/assets/22519730/files/2020-02-24_23-53-23-a806ae0cd151554115ac5ffe7dec1a41/1/hls/AVC_1920x1080_800k_AAC-HE_64k/aa000afee21e6278b65683de1eac381e8d83.m3u8?provider=verizon&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiMjAyMC0wMi0yNF8yMy01My0yMy1hODA2YWUwY2QxNTE1NTQxMTVhYzVmZmU3ZGVjMWE0MS8xLyIsImV4cCI6MTYxOTQ0Njk1Mn0.pi7JvnpYLfxgK4KtsMYyT3tzLRhw9bFuTkZHpgw8u78&v=1'

vs

[debug] Invoking downloader on 'https://knowband-asset-bucket.s3.amazonaws.com/2020-02-24_23-14-43-4b84b17b8a746b328e2861e663d5a32c/WebHD_720p.mp4'

I can provide credentials as needed via email or lastpass whatever works best.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
smaga38commented, Jul 19, 2021

Thanks to @jadence who said the following:
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!

0reactions
dirkfcommented, Apr 27, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to download video from Udemy 'HTTP Error 403 ...
[Udemy] Course download does not work on some courses and returns 403 forbidden after passing the publically available preview videos #28877.
Read more >
How to Troubleshoot Downloading Issues on The App
This article explains how to fix some of the more common issues related to downloading courses and lectures on the Udemy mobile app.......
Read more >
How to Fix The 403 Forbidden Error [Step by Step] ☑️
In today's video we take a look at how to fix the 403 Forbidden Error.The 403 Forbidden error is an HTTP status code...
Read more >
What Is the 403 Forbidden Error and How to Fix It (8 Methods ...
You might encounter the 403 forbidden error when you visit an empty website directory or a specific page that has a permission error....
Read more >
HTTP Error 403 Forbidden Messages: What They Are & How ...
It means the page you were trying to reach is forbidden for one of two reasons: Either there is a removal or restriction...
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