downloading-courses-from-linux-academy.md

  1---
  2title: Downloading courses from Linux Academy
  3subtitle: youtube-dl is a phenomenal tool
  4author: Amolith
  5description: Using youtube-dl to pull Linux Academy courses for offline viewing
  6date: 2019-10-19T01:35:00-0400
  7draft: false
  8cover: /assets/pngs/youtube-dl.png
  9categories:
 10  - Technology
 11tags:
 12  - youtube-dl
 13  - Linux Academy
 14  - Training
 15toc: true
 16---
 17
 18## Forward
 19Every month, Linux Academy releases courses for free. I'm a very busy
 20college student and don't have time to whirl through everything I want
 21to before it goes behind their paywall again so I figured out how to
 22download a course or two every month using
 23[`youtube-dl`.](https://github.com/ytdl-org/youtube-dl/)
 24
 25## Setup
 26* Install
 27  [`youtube-dl`](https://ytdl-org.github.io/youtube-dl/download.html)
 28* Make sure you have a browser handy
 29* Create a community account on Linux Academy
 30* Get some food
 31* Maybe a drink
 32* Sit back down in your chair
 33* Spin around a bit
 34* Read on
 35
 36## Downloading
 37* Log into your account
 38* Pick the course you want
 39* Open the developer console and go to `Network` (Ctrl+Shift+E in
 40  Firefox)
 41* You'll want to select `Media` as shown in the screenshot below
 42
 43*In moving my posts around, this screenshot has disappeared* :shrug:
 44
 45* Click the video you want to start with
 46* Watch the network logs
 47* You'll see an entry that starts with `playlist` (screenshot below)
 48
 49*In moving my posts around, this screenshot has disappeared* :shrug:
 50
 51* Right click it
 52* Copy the URL
 53* Paste it after `youtube-dl` in a terminal:
 54
 55``` bash
 56amolith@poseidon:~ $ youtube-dl https://video-cdn.linuxacademy.com/vods3/_definst_/smil:box/cdnstore/modules/lots-of-stuff-in-here
 57```
 58
 59* Press enter
 60* Watch the magic unfold
 61
 62At a high level, `youtube-dl` is acting like your browser and following
 63the `m3u` playlist to download chunks of the file. After it fetches them
 64all, it runs them through `ffmpeg` to stitch them together into a single
 65video!
 66
 67I found it useful to open a text editor and script downloading a whole
 68course at a time. All you have to do is type `youtube-dl -o` and
 69copy/paste it however many times there are videos. Then, copy and paste
 70the video title in quotes after `-o` and add `.mp4` to the end (command
 71example below). After that, paste the URL. Do that with every video in
 72the series, save the script, run `chmod +x <script>`, then `./<script>`
 73and (after a bit) you'll have an entire course you can watch at your
 74leasure!
 75
 76``` bash
 77amolith@poseidon:~ $ youtube-dl -o "04 - Conclusion and Next Steps.mp4" https://video-cdn.linuxacademy.com/vods3/_definst_/smil:box/cdnstore/modules/lots-of-stuff-here
 78```
 79
 80**NOTE:** You may want to set up your directory structure beforehand so
 81it's easier to script the process. Here's an example of one of mine:
 82
 83``` bash
 84amolith@poseidon:~/Videos/Courses/Ansible - Playbooks Deep Dive $ tree
 85.
 86+-- 01 - Course Overview
 87|   +-- 01 - About the Course.mp4
 88|   +-- 02 - About the Training Architect.mp4
 89|   +-- 03 - Course Features and Tools.mp4
 90|   +-- 04 - About Ansible Playbooks.mp4
 91|   \-- 05 - Advanced Inventory Configuration.mp4
 92+-- 02 - Playbook Basics
 93|   +-- 01 - Using YAML for Ansible Playbooks.mp4
 94|   +-- 02 - Creating an Ansible Play.mp4
 95|   +-- 03 - The ansible-playbook Command.mp4
 96|   \-- 04 - Understanding Playbook Tasks.mp4
 97+-- 03 - Essential Playbook Syntax
 98|   +-- 01 - Using Variables in Playbooks.mp4
 99|   +-- 02 - Working with Templates.mp4
100|   +-- 03 - Using Ansible Facts.mp4
101|   +-- 04 - Conditional Execution in Playbooks.mp4
102|   +-- 05 - Using Loops in Ansible.mp4
103|   \-- 06 - Working with Handlers in Ansible.mp4
104+-- 04 - Advanced Playbook Syntax
105|   +-- 01 - Executing Selective Parts of a Playbook.mp4
106|   +-- 02 - Working with Sensitive Data Using Ansible Vault.mp4
107|   +-- 03 - Error Handling in a Playbook: limit, ignore_errors, changed_when, and failed_when.mp4
108|   +-- 04 - Error Handling in a Playbook: Block Groups and The Debug Module.mp4
109|   +-- 05 - Asynchronous Tasks within a Playbook.mp4
110|   +-- 06 - Delegating Playbook Execution with delegate_to and local_action.mp4
111|   +-- 07 - Parallelism in Playbooks.mp4
112|   +-- 08 - Using run_once.mp4
113|   +-- 09 - Overview of Ansible Roles.mp4
114|   \-- 10 - Ansible Role Demo.mp4
115\-- 05 - Conclusion and Next Steps.mp4
116
1174 directories, 26 files
118amolith@poseidon:~/Videos/Courses/Ansible - Playbooks Deep Dive $
119```