Monday, 14 August 2017

Downloaded Youtube content on Plex

08:40 Posted by Jurgens Krause No comments
My internet provider gives me uncapped data at night, but severely capped and throttled during the day. For this reason, I like to download some videos from YouTube and then make them accessible on my Plex server. This is especially handy for my wife, who loves a certain popular exercise channel.

Whatever your reason for putting YouTube videos on your Plex server, this is a handy guide to getting those videos on the server easily accessible.
This is a partly automated and partly manual process, but I have reached the point where I can import and make available the downloads for an entire channel in a very short timespan.

This guide assumes a couple of things.

1. You are running Plex on a Linux server (though all the utilities work under Windows as well)
2. You know how to install utilities on your Linux server. If you don't Google is your friend

Step 1: Install youtube-dl on your server
The instructions for installation are available on

Step 2: Create a directory for your YouTube media. We will download the media straight into the final folder.

Step 3: Find the channel that you want to download. For channels with hundreds of videos, I ile to group the videos by playlist, where each playlist becomes one season of the specific show.

3.1 - Visit the Playlists page for the specific channel
3.2 - Using a link clipping plugin (I use link klipper on chrome) extract all the playlist links from the page.
3.3 - Link Klipper creates a CSV file that I sanitize using Notepad ++ into a list with all the playlists that I want to download. (I use Notepad++ extensively, and it's column edit mode comes in handy in a bit)

Step 4: Modify the text file as per below:
4.1 - Add the following text to the beginning of each line in the text file:
youtube-dl -i --yes-playlist -o './Khan\ Academy/Season 01/Khan\ Academy - S01e%(playlist_index)s - %(title)s.%(ext)s' --write-thumbnail --add-metadata --metadata-from-title '%(title)s' --xattrs --download-archive ./progress.txt -f 22

Your file should now look something like this:

Remember to change the Season number on each line, so that each playlist will end up in it's own folder.

Step 5: Put the text file on your server in the root directory of your YouTube content
I usually just copy the text to the clipboard on my pc, and then paste it into a putty session with VIM running.

5.1 - Open a Putty session to your server
5.2 - Navigate to your YouTube folder
5.3 - Using your favourite text editor, open a new file called (or
5.3 - Paste the contents of the text file containing the playlist into this new file.
5.4 - Run the following command:

This will start the download, name the files and put them in the right folders

Step 6: Adding the content to your Plex Server
6.1 - Add a new "TV Shows" library to your Plex Server calling it "YouTube" or whatever works for you.
6.2 - Add the YouTube folder containing the downloaded YouTube content
6.3 - Under the Advanced tab, set the scanner to "Plex Series Scanner" and the agent to "Personal Media Shows"

Additional Tasks:

I like to create a nice show poster in photoshop, so that the show looks neat on my server, I also manually create and set a season poster for each season, that has the Playlist title on the season poster. This makes it easy to know what content is in each season.


Post a Comment