2 min read

Dockerized Utility To Download Udemy Courses

Simple applications can be dockerized to be of small footprint and easy deploy/sharing.
Dockerized Utility To Download Udemy Courses

***Note - this is strictly for educational purposes and it is illegal to download courses from Udemy. I will not be held accountable for any legalities you may end up with if it is used to download the courses***

Udemy offers great courses at an affordable cost. I am a huge fan and I have taken up quite a few courses myself ranging from technology to photography. Yes, the variety is very much appreciated and the best part is they are all affordable! Goes with my principle of knowledge must be free.

I found out that there is a python based program to download the courses, created by an engineer. These downloads are possible only for;

  1. If you have actually purchased the course and is in your learning library.
  2. The idea is to make it available for offline learning considering the inconsistencies with the internet.

You can find his repository at https://github.com/r0oth3x49/udemy-dl.git

The pre-requisites are;

  1. Python 3
  2. Python modules (mentioned in his requirements.txt)

I wanted to run it on a machine that is mostly ON at my household and hence came the idea of creating a docker image for the same. The idea was to run the docker container specifically created for this and run it on my NAS.

I created a Dockerfile based on Debian:slim-buster image and after I built it with all the dependencies, the size comes to 524 MB. That isn't bad considering it is on-demand, can run on any platform with docker, and does just that -> downloading the required courses.

Docker

Install docker desktop for your platform. In my case, I have it installed on my MAC.

Dockerfile

I started off creating a docker file so that it can pull the base image, download the git repository with python source code and install its dependencies, etc. I also created a volume named '/downloads' that can be mapped with a folder on your host machine for downloaded courses.


FROM python:slim-buster

RUN apt-get -y update && apt-get install -y git ffmpeg && \

    git clone https://github.com/r0oth3x49/udemy-dl.git && \

    cd udemy-dl && pip install -r requirements.txt && \

    mkdir -p /downloads

VOLUME ["/downloads"]

CMD ["bash"]


Create docker image using

docker build . -f dockerfile -t rsivanandan/udemy

After it is created, create a container instance;

docker run -it -v <destination folder>:/downloads rsivanandan/udemy

It should launch and present you a bash shell.

The syntax to invoke the command would be;

python /udemy-dl/udemy-dl.py -u <username> -p <password> -o /downloads <course link>

There, this was a good exercise to build your own docker image and run it. In my case, I copied the dockerfile to the NAS and created the container from the NAS and it works just fine.

Hope you'll find it interesting.