Table of Contents
1. Introduction
Some years ago there was beautiful time when you can buy software or course in the physical box and you own it. Means you can play whenever you want. These days companies running for subscription business model including home appliances that breaks just week after warranty. What if you can change that? What if you can keep what yours? In this quick tutorial I am going to show you how download video course from udemy platform (btw can be applied to any other) using open source and completely free tool ffmpeg.
2. Install ffmpeg
Tool is available on all platforms as installer, plus you can build it yourself from sources and even dockerize if needed.
Follow instruction on their website and get it ready.
3. Inspect tab is essential
Whenever you are playing video course on udemy please open developer mode in web browser or simply right click and choose inspect. Then switch to network tab and with search functionality look for m3u8 files. This is playlist for streaming. Some course websites do not do streaming, they sharing direct video files so you will look for mp4 rather than playlist. In such case simply double click on that entry and video will open in new tab. Right click and save as. Period.
But in this tutorial I want to focus on the case when video is streamed, so once you click on m3u8 entry then GET request address should appear like on below screenshot
That GET request contain address of the file in one of Content Delivery Network (CDN) host, plus authentication token. This is needed to access it. Copy that whole address, will be needed in next download step.
4. Download video course
You can use environment variable to store URL for clearance but it is not required of course.
export your_inspect_URL="https://www.udemy.com/assets/34869296/files/2021-07-14_20-04-21-12b696f50a4d6228049660b322f5f93c/2/hls/AVC_1280x720_600k_AAC-HE_64k/aa00a18a484c57ddffb33248fafcd3232795.m3u8?provider=cdn77&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiMjAyMS0wNy0xNF8yMC0wNC0yMS0xMmI2OTZmNTBhNGQ2MjI4MDQ5NjYwYjMyMmY1ZjkzYy8yLyIsImV4cCI6MTcyODk0NTMxNn0.8ulsShUsA0kMFnqiGgkEmZHoDIWukbppMqAFeqqErSA&v=1"
then run ffmpeg to download it
ffmpeg -i "$your_inspect_URL" \
-c copy \
"udemyTEST.mp4"
It will start pulling chunks into disk. After that step you can play the video.