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
 30  Academy](https://linuxacademy.com/join/community)
 31* Get some food
 32* Maybe a drink
 33* Sit back down in your chair
 34* Spin around a bit
 35* Read on
 36
 37## Downloading
 38* Log into your account
 39* Pick the course you want
 40* Open the developer console and go to `Network` (Ctrl+Shift+E in
 41  Firefox)
 42* You'll want to select `Media` as shown in the screenshot below
 43
 44*In moving my posts around, this screenshot has disappeared* :shrug:
 45
 46* Click the video you want to start with
 47* Watch the network logs
 48* You'll see an entry that starts with `playlist` (screenshot below)
 49
 50*In moving my posts around, this screenshot has disappeared* :shrug:
 51
 52* Right click it
 53* Copy the URL
 54* Paste it after `youtube-dl` in a terminal:
 55
 56``` bash
 57amolith@poseidon:~ $ youtube-dl https://video-cdn.linuxacademy.com/vods3/_definst_/smil:box/cdnstore/modules/lots-of-stuff-in-here
 58```
 59
 60* Press enter
 61* Watch the magic unfold
 62
 63At a high level, `youtube-dl` is acting like your browser and following
 64the `m3u` playlist to download chunks of the file. After it fetches them
 65all, it runs them through `ffmpeg` to stitch them together into a single
 66video!
 67
 68I found it useful to open a text editor and script downloading a whole
 69course at a time. All you have to do is type `youtube-dl -o` and
 70copy/paste it however many times there are videos. Then, copy and paste
 71the video title in quotes after `-o` and add `.mp4` to the end (command
 72example below). After that, paste the URL. Do that with every video in
 73the series, save the script, run `chmod +x <script>`, then `./<script>`
 74and (after a bit) you'll have an entire course you can watch at your
 75leasure!
 76
 77``` bash
 78amolith@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
 79```
 80
 81**NOTE:** You may want to set up your directory structure beforehand so
 82it's easier to script the process. Here's an example of one of mine:
 83
 84``` bash
 85amolith@poseidon:~/Videos/Courses/Ansible - Playbooks Deep Dive $ tree
 86.
 87+-- 01 - Course Overview
 88|   +-- 01 - About the Course.mp4
 89|   +-- 02 - About the Training Architect.mp4
 90|   +-- 03 - Course Features and Tools.mp4
 91|   +-- 04 - About Ansible Playbooks.mp4
 92|   \-- 05 - Advanced Inventory Configuration.mp4
 93+-- 02 - Playbook Basics
 94|   +-- 01 - Using YAML for Ansible Playbooks.mp4
 95|   +-- 02 - Creating an Ansible Play.mp4
 96|   +-- 03 - The ansible-playbook Command.mp4
 97|   \-- 04 - Understanding Playbook Tasks.mp4
 98+-- 03 - Essential Playbook Syntax
 99|   +-- 01 - Using Variables in Playbooks.mp4
100|   +-- 02 - Working with Templates.mp4
101|   +-- 03 - Using Ansible Facts.mp4
102|   +-- 04 - Conditional Execution in Playbooks.mp4
103|   +-- 05 - Using Loops in Ansible.mp4
104|   \-- 06 - Working with Handlers in Ansible.mp4
105+-- 04 - Advanced Playbook Syntax
106|   +-- 01 - Executing Selective Parts of a Playbook.mp4
107|   +-- 02 - Working with Sensitive Data Using Ansible Vault.mp4
108|   +-- 03 - Error Handling in a Playbook: limit, ignore_errors, changed_when, and failed_when.mp4
109|   +-- 04 - Error Handling in a Playbook: Block Groups and The Debug Module.mp4
110|   +-- 05 - Asynchronous Tasks within a Playbook.mp4
111|   +-- 06 - Delegating Playbook Execution with delegate_to and local_action.mp4
112|   +-- 07 - Parallelism in Playbooks.mp4
113|   +-- 08 - Using run_once.mp4
114|   +-- 09 - Overview of Ansible Roles.mp4
115|   \-- 10 - Ansible Role Demo.mp4
116\-- 05 - Conclusion and Next Steps.mp4
117
1184 directories, 26 files
119amolith@poseidon:~/Videos/Courses/Ansible - Playbooks Deep Dive $
120```