Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)1 export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
$ youtube-dl --cookies ./udemy-cookies.txt https://www.udemy.com/course-name/

Notes

  • If you have previously installed youtube-dl, you should update it before attempting to download your Udemy courses
    $ youtube-dl -U
    
  • If you want your videos to be organized by chapter and the indices included, you can specify the output flag -o
    $ youtube-dl --cookies ./udemy-cookies.txt -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' https://www.udemy.com/course-name/
    
# List available formats
youtube-dl -u <username> -p <password> -F -o './videos/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/course-name/
# Download the specified format
youtube-dl -u <username> -p <password> -f <desired-format> -o './videos/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/course-name/
# Download specific items
youtube-dl <url> --cookies <cookies-filename> --playlist-items "<comma-separated-indices>"
# Skip specific indices
youtube-dl <url> --cookies <cookies-filename> --playlist-start START_NUMBER
@ds2k5

This comment has been minimized.

Copy link

commented Sep 1, 2017

Hi,
you can do this if you want to download the hole course Videos

youtube-dl -u USERNAME -p PASSWORD UDEMY-Course-URL/.../content

@ibro45

This comment has been minimized.

Copy link

commented Nov 19, 2017

Thanks a lot! It is important to note that youtube-dl should be updated to the latest version, it didn't work for me until i reinstalled it manually.

@codeangler

This comment has been minimized.

Copy link

commented Nov 24, 2017

The following will:

  1. download to the folder you are running the command from
  2. run on windows
  3. put a sequential number in front of each course title 001-999

You will need to

  1. put in your uDemy email address
  2. put in your uDemy password
  3. replace the example url at the end of this code snippet with one you've purchased
youtube-dl -u string@gmail.com -p passwordstring -o "./%(playlist)s/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s" https://www.udemy.com/the-complete-elixir-and-phoenix-bootcamp-and-tutorial/learn/v4/content
@marwankous

This comment has been minimized.

Copy link

commented Nov 26, 2017

Is it possible to download paid courses for free?

@ChongWng

This comment has been minimized.

Copy link

commented Nov 28, 2017

@marwankous Obviously you can't. Courses will be downloaded from your own udemy account.

@PorkChopExpress86

This comment has been minimized.

Copy link

commented Dec 10, 2017

This is excellent! I can not take all of my courses where ever I go. Great work guys!

@shuboy2014

This comment has been minimized.

Copy link

commented Dec 12, 2017

It says,

[generic] ?next=/nginx-fundamentals/learn/v4/content: Downloading webpage
[generic] ?next=/nginx-fundamentals/learn/v4/content: Extracting information
ERROR: Unsupported URL: https://www.udemy.com/?next=%2Fnginx-fundamentals%2Flearn%2Fv4%2Fcontent
@meetajhu

This comment has been minimized.

Copy link

commented Dec 13, 2017

@shuboy2014

Your url should be https://www.udemy.com/nginx-fundamentals/

Example:-

youtube-dl https://www.udemy.com/nginx-fundamentals/ --cookies yourcookiesfile.txt

@imthecapedbaldy

This comment has been minimized.

Copy link

commented Jan 20, 2018

Wow i just found this after i've downloaded with no other options. 309 videos. Gigabytes of data. Downloaded, UN-ORGANIZED. Welp thanks for this. By the way is it necessary or safer to wrap the username and password in anything? Like quotation marks or whatsoever.

@tiderdev

This comment has been minimized.

Copy link

commented Jan 29, 2018

hello, i tried to use this way to download my enrolled course but it says => Unable to download webpage: <urlopen error [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)'),))

what did i do wrong?

i use this command:

youtube-dl -u string@gmail.com -p 'mypassword' -o "./%(playlist)s/%(chapter_number)s-%(chapter)s/%(autonumber)03d-%(title)s.%(ext)s" https://www.udemy.com/elasticsearch101/learn/v4/content

@taymourniazi

This comment has been minimized.

Copy link

commented Feb 3, 2018

I try downloading it throuh python spyder. it shows me error syntax. so i tried direct from anaconda prompt and this really works thanks @codeangelar

@kmaslam

This comment has been minimized.

Copy link

commented Mar 9, 2018

Is there a way I could download udemy videos from udemy for business? The custom URL is like mycompany.udemy.com but youtube-dL is not taking it..

@mohit2494

This comment has been minimized.

Copy link

commented Mar 24, 2018

Is there a way that youtube-dl arranges the videos in folders as per the sections in the udemy courses ?

@crivatg

This comment has been minimized.

Copy link

commented Apr 1, 2018

youtube-dl -u your_email -p 'your_password' -f 'best' https://www.udemy.com/yourcourse -o '%(playlist)s/%(chapter_number)s. %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s'

@francishero

This comment has been minimized.

Copy link

commented Apr 22, 2018

i used this one! really really good https://github.com/FaisalUmair/udemy-downloader-gui

@AdilAhmedunar

This comment has been minimized.

Copy link

commented Apr 26, 2018

How can i download IDM ??

@kejsiStruga

This comment has been minimized.

Copy link

commented Apr 27, 2018

Please how can we download udemy business video, tried prepending /learn/v4 but still wont accept the url format.
Thanks!

@nara20

This comment has been minimized.

Copy link

commented Apr 29, 2018

Hi,

Using the command line \youtube-dl --cookies Cookies.txt https://www.udemy.com/70473-azure/learn/v4/content I have the following error : "ERROR : No video formats found"
See also attached file.

udemy
Regards,
Nara20

@duckyvirus

This comment has been minimized.

Copy link

commented May 3, 2018

I was getting the same as Nara20. then I updated to 2018.05.01 and now I get a 403: Forbidden error

@SylaCha

This comment has been minimized.

Copy link

commented May 6, 2018

I met this error, and What should I do next for fixing this problem? Please kindly help me!

31914322_187196025242431_4160606184811790336_n

image

@CesarBarros

This comment has been minimized.

Copy link

commented May 19, 2018

Now I am able to download the videos again.
For me the solution was:

$ sudo youtube-dl -U
$ Password:
Updating to version 2018.05.18 ...
Updated youtube-dl. Restart youtube-dl to use the new version.

$ youtube-dl --version
2018.05.18

$ youtube-dl --cookies ./udemy-cookies.txt -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' https://www.udemy.com/course-name/
@Laksmi1940

This comment has been minimized.

Copy link

commented May 23, 2018

Hi, how to save the Cookie.txt?? Where I can get that cookie. Can you help me please?? In Chrome browser there is no option for cookie.

@adhikar

This comment has been minimized.

Copy link

commented May 26, 2018

youtube-dl is not working -see error below
PS D:> youtube-dl https://harbingergroup.udemy.com/azure-deploying-virtual-machines/learn/v4/
[generic] v4: Requesting header
WARNING: Could not send HEAD request to https://udemy.com/azure-deploying-virtual-machines/learn/v4/: HTTP Error 403: Unauthorized
[generic] v4: Downloading webpage
ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by <HTTPError 403: 'Unauthorized'>); 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.

@suryastef

This comment has been minimized.

Copy link

commented Jun 12, 2018

how to download whole course with attached files and web page?
all this time I use this, just downloading videos and subs:
$ youtube-dl --verbose --write-sub --cookies ./udemy-cookies.txt -f best -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' https://www.udemy.com/course-name/

@atalakey

This comment has been minimized.

Copy link

commented Jun 14, 2018

Anyone knows how to download courses from a Udemy for business account?

EX. youtube-dl -v -u username -p password -o '~/somefolder/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://company.udemy.com/course_name/

@spidy95

This comment has been minimized.

Copy link

commented Jun 16, 2018

How to download specific section of videos in udemy course content

@tiendungitd

This comment has been minimized.

Copy link

commented Jun 25, 2018

it not work with udemy business. I'm using 2018.06.25 version
[generic] terraform-beginner-to-advanced: Requesting header WARNING: Could not send HEAD request to https://aaaa.udemy.com/terraform-beginne r-to-advanced/: HTTP Error 403: Unauthorized [generic] terraform-beginner-to-advanced: Downloading webpage ERROR: Unable to download webpage: HTTP Error 403: Unauthorized (caused by HTTPE rror()); please report this issue on https://yt-dl.org/bug . Make sure you are u sing the latest version; type youtube-dl -U to update. Be sure to call youtube -dl with the --verbose flag and include its complete output.

@Muhammadbarznji

This comment has been minimized.

Copy link

commented Jul 17, 2018

thank you so much 👍 :)

@samme4life

This comment has been minimized.

Copy link

commented Jul 24, 2018

Hi All,
This is a very useful tool. I have downloaded a massive course using the method @codeangler suggested.
However, I got the following error when downloading 325th lecture,

disconnected

Does anybody know how to download from certain chapter/section or certain video onwards?

Please help

Regards
Samme

@julietezekwe

This comment has been minimized.

Copy link

commented Aug 6, 2018

I am getting this error that the course is not free that I pay for it but I already purchased the course
Course 1362070 is not free. You have to pay for it before you can download. Use this URL to confirm purchase: https://www.udemy.com/cart/checkout/express/course/1362070/?discountCode=1808UDEMYBESTSELLERS

I need help

@ZahreddineSoualem

This comment has been minimized.

Copy link

commented Sep 1, 2018

how can ai download my courses using new update of youtube-dl ?? can anyone helps me ?

@kaanpoyrazz

This comment has been minimized.

Copy link

commented Sep 4, 2018

udemy coupons website : https://www.99udemycoupon.com/

@adambergquist

This comment has been minimized.

Copy link

commented Dec 10, 2018

Hey all, I just got this working for udemy and wanted to post my solution.

First, the username and password are no longer used and must be passed using a cookie.

To get the cookie data, use your browser's developer tools. Select the network tab and filter for "start". You can probably use other elements but this is what I used. For the "start" element look at the header info. Under request headers look at the raw cookie data. Build the cookie into netscape format. I used https://crdx.org/cookies/ but a google search should find an online utility. Create a text file and point to it with the --cookie command. My youtube-dl example is below. Hope this helps!

youtube-dl --cookie ~/cookie_udemy -o './udemy/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/complete-python-bootcamp

@asdmin

This comment has been minimized.

Copy link

commented Jan 28, 2019

To get the cookie data, use your browser's developer tools. Select the network tab and filter for "start". You can probably use other elements but this is what I used. For the "start" element look at the header info. Under request headers look at the raw cookie data. Build the cookie into netscape format. I used https://crdx.org/cookies/ but a google search should find an online utility. Create a text file and point to it with the --cookie command. My youtube-dl example is below. Hope this helps!

It's easier to use a browser extension (https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/) to get the cookies directly, and you don't need to use complicated procedures, and expose them to external services.

@carlosuema

This comment has been minimized.

Copy link

commented Jan 28, 2019

To get the cookie data, use your browser's developer tools. Select the network tab and filter for "start". You can probably use other elements but this is what I used. For the "start" element look at the header info. Under request headers look at the raw cookie data. Build the cookie into netscape format. I used https://crdx.org/cookies/ but a google search should find an online utility. Create a text file and point to it with the --cookie command. My youtube-dl example is below. Hope this helps!

It's easier to use a browser extension (https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/) to get the cookies directly, and you don't need to use complicated procedures, and expose them to external services.

Hello!

I used this method with cookies and was very happy. But it does not seem to work anymore. Could you confirm me?

@varunjha089

This comment has been minimized.

Copy link

commented Jan 29, 2019

Is this technique will work for downloading the course from LinkedIn learning

@charlieInDen

This comment has been minimized.

Copy link

commented Feb 6, 2019

Please how can we download udemy business video, tried prepending /learn/v4 but still wont accept the url format.
Thanks!

@imdadareeph

This comment has been minimized.

Copy link

commented Mar 15, 2019

youtube-dl -u your_email -p 'your_password' -f 'best' https://www.udemy.com/yourcourse -o '%(playlist)s/%(chapter_number)s. %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s'

This worked like a charm!!!

udemydownload

@Jametomdavid

This comment has been minimized.

Copy link

commented Apr 6, 2019

Method 1: Use Allavsoft to Download Udemy Videos to MP4 or MP3
Method 2: Download Udemy Videos in Ubuntu
Method 3: Download udemy videos with IDM
Method 4: Download Udemy videos using Python
Method 5: Download Udemy videos from browser
Resources: https://www.avdshare.com/top-5-methods-to-download-udemy-videos

@MrAidynShorts

This comment has been minimized.

Copy link

commented May 15, 2019

For those who are having trouble, I've _tested both the Windows & Python (2.7) versions and documented my findings, which should help.

  1. The URL Path should be formatted as follows (DO NOT Add /learn/v4/content, from the examples, to the URL Path).
    https://www.udemy.com/<course_name>/
  2. To Download the Course Videos, as is (Lacking File Name and/or Directory Organization) use the following Command:
    youtube-dl -u user@domain.com -p P@ssw0rd https://www.udemy.com/mta-windows-server-administration-fundamentals/
  3. To Download the Course Videos, w/ Folder & File Organization, use the following.
    youtube-dl -u user@domain.com -p P@ssw0rd -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' https://www.udemy.com/mta-windows-server-administration-fundamentals/
  4. If you get an Error, before you've finished Downloading the entire course, include the "--playlist-start" Command, to pickup where it left off.
    NOTE: From experience, most Errors tend to be thrown during the "Downloading Webpage" or "Downloading JSON" Stages, just before Downloading the Video File, itself. Therefore, if an Error was thrown just after Video #20 has Finished Downloading and Video #21 is Starting Up, simply insert --playlist-start 21 at the end of the previous command, above (as seen in the example, below).
    youtube-dl -u user@domain.com -p P@ssw0rd -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s' https://www.udemy.com/mta-windows-server-administration-fundamentals/ --playlist-start 21

I hope this helps those who may be struggling to Download your Udemy Courses, etc.

@CeeDee-ux

This comment has been minimized.

Copy link

commented Aug 17, 2019

Anyone there who could figure out what's causing the error, please help:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--cookies', u'./udemy-cookies.txt', u'-u', u'PRIVATE', u'-p', u'PRIVATE', u'-o', u'%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s. %(title)s.%(ext)s', u'https://www.udemy.com/course/the-complete-web-development-bootcamp/', u'--playlist-start', u'1']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.08.13
[debug] Python version 2.7.12 (CPython) - Linux-4.4.0-81-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: none
[debug] Proxy map: {}
[udemy:course] Downloading login popup
[udemy:course] Logging in
[udemy:course] course: Downloading webpage
[udemy:course] 1565838: Downloading course curriculum
[download] Downloading playlist: 1565838
[udemy:course] playlist 1565838: Collected 283 video ids (downloading 283 of them)
[download] Downloading video 1 of 283
[udemy] Downloading login popup
[udemy] 12638830: Downloading webpage
[udemy] 12638830: Downloading lecture JSON
[udemy] 12638830: 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; 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.

@kollaesch

This comment has been minimized.

Copy link

commented Sep 2, 2019

I got the same problem. Apparently they changed the login-process.
This really sucks. The original download-feature from udemy to download to iOS isn't working. (shame on them!)
And the second approach also not. Hopefully you'll get this fixed.

@terrabitz

This comment has been minimized.

Copy link

commented Sep 27, 2019

@kollaesch @CeeDee-ux I was getting the same error originally by using the following URL, which goes to the main course homepage:

https://www.udemy.com/course/<course_name>/

However, it seems to be working with the following:

https://www.udemy.com/<course_name>/

@marcvisconte

This comment has been minimized.

Copy link

commented Oct 4, 2019

MrAidynShorts' comments were the most helpful. Two, in particular, were essential:

For those who are having trouble, I've _tested both the Windows & Python (2.7) versions and documented my findings, which should help.
1. The URL Path should be formatted as follows (DO NOT Add /learn/v4/content, from the examples, to the URL Path).
https://www.udemy.com/<course_name>/

That, alone helped get my d/l's started.
The next one was a LIFE SAVER. When you have multiple courses with hundreds of chapters and lessons, restarting from the beginning is not an option.

4. If you get an Error, before you've finished Downloading the entire course, include the "**--playlist-start**" Command, to pickup where it left off.

Packt recently had a weekend of free access, and I tried to stay up all night to take advantage.
I couldn't figure out how to do the playlist thing, so when a download crashed, I handled it by:
a) making note of where the last course download failed,
b) start the next course, and, while that was queuing and downloading,
c) I would do a screen-scrape of the chapters and lessons for the course that failed the download,
d) pull the scrape content into another program, extract the chapter URL listing and put it into an external file, and then
e) process those as individual video downloads using the " -a file.txt" option.

Now that I've got a handle on the --playlist-start and --playlist-end, I have a lot more flexibility.

Currently, I use the --playlist-start and --playlist-end to break large multi-chapter d/l's into sections, and then run youtube-dl from more than 1 session at a time. A great time-saver.

A hint re: cookies:
I tried using the "--cookies" option, but the browser add-on exported a humongous file of ALL cookies, 3200 lines, 368k.
On a whim, I included both the --username / --password authentication, and the --cookies option. I created an empty "newcookies.txt" file to reference.
I started a new downoad, and when it finished, youtube-dl updated the newcookies.txt with JUST THE COOKIES NECESSARY for the training website.

@kamilPyrkosz97

This comment has been minimized.

Copy link

commented Oct 12, 2019

Right now Im getting some m3u8 realated error when Im trying to downlaod videos from udemy. It should be fixed in next release. Is someone also having trouble with downloading videos from udemy now ? If not can you put the command which you typed and information about os and python version ?

After downlaoding someting like 10 videos I get : WARNING: Failed to download m3u8 information: <urlopen error [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1076)>
ERROR: unable to download video data: <urlopen error [SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1076)>

And right now every time when Im trying to download any other course I go the same.
Im typing:
youtube-dl -u someemail@wp.pl -p simpletest123 -o '/containerUdemy/%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/javascriptfundamentals/

youtube-dl --version -------> 2019.10.16
python --versino ------------> Python 3.7.4

[UPDATE]
I found out that udemy detect that it is a bot and after few minuates it block access. If you know how to solve this problem please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.