r0oth3x49 / udemy-dl

A cross-platform python based utility to download courses from udemy for personal offline use.
MIT License
4.83k stars 1.19k forks source link

BASH wrapper `download.sh` to be able to pull down multiple courses at once #657

Closed kigster closed 3 years ago

kigster commented 3 years ago

Why?

I have about 30 Udemy courses that I bought, and wanted to watch them on my Plex. I was very happy to have found this amazing Python Script.

Unfortunately, I am not very proficient in Python, so it was easier for me to put together a shell script that uses udemy-dl to download (serially, or concurrently) course videos for any number of courses specified in a simple toml file shown below.

Using the download.sh script I was able to pull down 256GB of courses!

What's Included

Downloading Multiple Courses at Once (Serially, or in Parallel)

A provided shell script download.sh is able to download multiple course at once, provided the following file exists: courses.toml:

[todo]
url="https://www.udemy.com/course/ableton-live-11-masterclass"
url="https://www.udemy.com/course/ableton-push-workflow-and-production"
url="https://www.udemy.com/course/ableton-live-11-course"

[done]
url="https://www.udemy.com/course/the-complete-internet-security-privacy-course-volume-1"
url="https://www.udemy.com/course/the-easy-beginner-drum-course"

You don't need to have any URLs in the [done] section, but you must keep the [done] section header. The script grabs all URLs between [todo] and [done]

In addition, the script:

Usage

To download multiple courses, follow these steps:

  1. create the file courses.toml of the format described above and below (also, see courses-example.toml file).
  2. create the file cookies.txt of the format access_token=XXX where XXX is your access token cookie (see above for how to get it).
  3. choose the output directory, or use the default folder: ~/Courses which will be auto-created.
  4. Run the script as follows:
# ./download.sh <courses-toml> [ optional-download-folder ]
# eg:
./download.sh courses.toml /Volume/ExternalHD/Courses

Downloading Concurrently

Using two additional environment variables you can tell the script to perform the operations in parallel, as well as to optionally generate the "info" file for each course, which is the result of the --info command.

export DOWNLOAD_CONCURRENTLY=1
export DOWNLOAD_INFO=1
./download.sh course.toml ~/Documents/Courses

download-sh

r0oth3x49 commented 3 years ago

@kigster udemy-dl do support downloading multiple courses sequentially from a file containing list of course urls separated by new lines. Thanks for the PR.

python udemy-dl -u USER -p PASS courses.txt

kigster commented 3 years ago

@r0oth3x49 I don't know how I missed that — where is that documented?