Puyodead1 aab19bf66f New Experimental Downloader, bug fixes, and small updates
+ Updated cleanup function to remove the entire temporary lecture folder instead of just leaving behind tons of empty folders
+ Fixed typo in mux function
+ Segment count is now properly calculated from segment timeline
+ Manifest is now parsed from the URL instead of being downloaded, this should be better for downloading multiple courses at once.
+ Fixed a bug where audio content_type would try to find a max quality
+ New Downloader: Threaded Downloader uses multiple threads to download files, this should improve download speeds greatly. By default, the threaded downloader is not used, you can use the threaded downloader by passing ``--use-threaded-downloader``. By default, it only uses 10 threads, you can set a custom number of threads with the ``--threads`` option
2021-05-21 13:38:24 -04:00
2021-05-20 19:56:09 -04:00
2020-11-05 23:55:16 +05:30
2021-05-18 10:15:54 -04:00
2021-05-18 17:16:18 -04:00
2021-05-21 09:27:49 -04:00
2021-05-19 15:59:49 -04:00

Udemy Downloader with DRM support

GitHub GitHub top language Codacy grade

NOTE

This program is WIP, the code is provided as-is and I am not held resposible for any legal issues resulting from the use of this program.

Support

if you want help using the program, join my discord server or use github issues

License

All code is licensed under the MIT license

Description

Simple program to download a Udemy course, has support for DRM videos but requires the user to aquire the decryption key (for legal reasons).
Current only Windows is supported but with some small modifications it should work on linux also (and maybe mac)

Requirements

  1. You would need to download ffmpeg and mp4decrypterfrom Bento4 SDK and ensure they are in path (typing their name in cmd invokes them).

Usage

quick and dirty how-to

You will need to get a few things before you can use this program:

  • Decryption Key ID
  • Decryption Key
  • Udemy Course URL
  • Udemy Bearer Token

Setting up

  • rename .env.sample to .env (you only need to do this if you plan to use the .env file to store your bearer token)
  • rename keyfile.example.json to keyfile.json

Aquire bearer token

  • open dev tools
  • go to network tab
  • in the search field, enter api-2.0/courses
  • Valid udemy api requests
  • click a random request
  • locate the Request Headers section
  • copy the the text after Authorization, it should look like Bearer xxxxxxxxxxx
  • bearer token example
  • enter this in the .env file after UDEMY_BEARER= (you can also pass this as an argument, see advanced usage for more information)

Key ID and Key

It is up to you to aquire the key and key id. Please don't ask me for help acquiring these, decrypting DRM protected content can be considered piracy.

  • Enter the key and key id in the keyfile.json
  • keyfile example
  • example key and kid from console

Start Downloading

You can now run python main.py to start downloading. The course will download to out_dir, chapters are seperated into folders.

Advanced Usage

usage: main.py [-h] -c COURSE_URL [-b BEARER_TOKEN] [-q QUALITY] [-t THREADS] [-l LANG] [--skip-lectures] [--download-assets]
               [--download-captions] [--use-threaded-downloader] [-d]

Udemy Downloader

optional arguments:
  -h, --help            show this help message and exit
  -c COURSE_URL, --course-url COURSE_URL
                        The URL of the course to download
  -b BEARER_TOKEN, --bearer BEARER_TOKEN
                        The Bearer token to use
  -q QUALITY, --quality QUALITY
                        Download specific video quality. (144, 360, 480, 720, 1080)
  -t THREADS, --threads THREADS
                        Max number of threads to use when using the threaded downloader (default 10)
  -l LANG, --lang LANG  The language to download for captions (Default is en)
  --skip-lectures       If specified, lectures won't be downloaded.
  --download-assets     If specified, lecture assets will be downloaded.
  --download-captions   If specified, captions will be downloaded.
  --use-threaded-downloader If specified, the experimental threaded downloader will be used
  • Passing a Bearer Token and Course ID as an argument
    • python main.py -c <Course URL> -b <Bearer Token>
    • python main.py -c https://www.udemy.com/courses/myawesomecourse -b <Bearer Token>
  • Download a specific quality
    • python main.py -c <Course URL> -q 720
  • Download assets along with lectures
    • python main.py -c <Course URL> --download-assets
  • Download assets and specify a quality
    • python main.py -c <Course URL> -q 360 --download-assets
  • Download captions (Defaults to English)
    • python main.py -c <Course URL> --download-captions
  • Download captions with specific language
    • python main.py -c <Course URL> --download-captions -l en - English subtitles
    • python main.py -c <Course URL> --download-captions -l es - Spanish subtitles
    • python main.py -c <Course URL> --download-captions -l it - Italian subtitles
    • python main.py -c <Course URL> --download-captions -l pl - Polish Subtitles
    • python main.py -c <Course URL> --download-captions -l all - Downloads all subtitles
    • etc
  • Skip downloading lecture videos
    • python main.py -c <Course URL> --skip-lectures --download-captions - Downloads only captions
    • python main.py -c <Course URL> --skip-lectures --download-assets - Downloads only assets
  • Use threaded downloader
    • python main.py -c <Course URL> --use-threaded-downloader
  • Use threaded downloader with custom max threads
    • python main.py -c <Course URL> --use-threaded-downloader --threads 15

Credits

Description
A Udemy downloader that can download lectures, with DRM support.
Readme 522 KiB
Languages
Python 80.9%
HTML 18.6%
Dockerfile 0.5%