How to successfully download Udemy courses with udemy-dl

Joel
2 min readMay 15, 2020

--

Photo by Lewis Keegan - Skillscouter.com on Unsplash

Lately, I have been having some issues downloading my purchased Udemy courses. After trying different libraries for achieving this, I found out a method that works pretty consistently for me.

Here’s a tutorial on how to download an udemy course on *nix systems, using udemy-dl.

In this example, we are going to use the cookie method (recovering the access token from udemy login session), which has been proved to be more effective than the other methods available.

1. Install udemy-dl

First, we need to install udemy-dl and its requirements :

git clone https://github.com/r0oth3x49/udemy-dl.git
cd udemy-dl
pip install -r requirements.txt

2. Get “Course URL” and “Access Token” from Cookies

Then, we need to define our COURSE_URL and our access_token.

For this step, head to udemy.com and make sure you are logged in with the account that purchased the course that you want to download.

Copy the course URL (https://www.udemy.com/course/course_full_name) and put it aside.

As an example, here’s the course URL for a photoshop cc course.

https://www.udemy.com/course/adobe-photoshop-cc-essentials-training-course/

To get the access_token on Google Chrome (once on Udemy.com):

  • First, right-click anywhere on the page, then click on “Inspect”
  • Click on “Applications”
  • Click on “Cookies”
  • Then search for “access_token”. It should look like a random string.
Getting access token from Chrome Inspect/Applications/Cookies
  • Create a file in the same directory called “cookies.txt and copy the access token. Your file should look something like this :

“cookies.txt”

access_token=BwlEeqk39otSBB5nnKKphJdb9r460Wdx124vqKop

3. Launch download

Once you have defined your cookies.txt file, it’s time to launch the download.

Replace COURSE_URL by your url in the code below and make sure you are in the right directory where udemy-dl and cookies.txt are.

python udemy-dl.py COURSE_URL -k cookies.txt

The course will be downloaded to the current folder by default.

Alternatively, if you want to change the output/download folder, you can do so with the -o option:

python udemy-dl.py COURSE_URL -k cookies.txt -o <Path to preferred download folder>

If this was helpful, please consider following me.

Enjoy the course!

--

--