Youtube Archive Tutorial
This tutorial covers setting up yt-dlp
and ytarchive
to download livestreams, videos, playlists and channels.
Table of Contents
- Prerequisites
- Using yt-dlp
- Downloading entire channels
- Downloading livestreams
- Content sharing
- HoloTools/HoloStats
- Troubleshooting/FAQ
Prerequisites
Installing chocolatey on Windows
- Open PowerShell in elevated mode
- Open the start menu by pressing the ⊞ windows key, type cmd, right click
Windows PowerShell
and clickingRun as administrator
.
- Open the start menu by pressing the ⊞ windows key, type cmd, right click
- Run the following command in PowerShell by pasting it in(CTRL+V) and pressing enter.
Set-ExecutionPolicy Bypass -Scope Process -Force; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- Restart PowerShell, then verify chocolatey has been installed by running the command
choco -?
.
Installing Python and FFmpeg using chocolatey
- Using the same PowerShell window from before, run the following command by pasting it in(CTRL+V) and pressing enter.
choco install -y python ffmpeg
- Restart PowerShell, then verify both programs have been installed by typing
python --version
andffmpeg -version
Installing yt-dlp
-
Open PowerShell or CMD whatever you prefer
-
Run the following command by pasting it in(CTRL+V) and pressing enter.
python -m pip install --upgrade yt-dlp
- Restart CMD/PowerShell, then verify that yt-dlp has been installed by typing
yt-dlp --version
Using yt-dlp
If you wish to learn the CLI commands yourself, use the yt-dlp -h
command or refer to this README.
Downloading videos
-
You can use this script to download single videos which incorporates all the recommended flags. Save the script to the directory where you want to save the video to and run it.
-
You can use this script to download playlists which incorporates all the recommended flags. To update a downloaded playlist, simply run the script again with the same playlist URL.
-
This is the basic command to download a video to the current directory
yt-dlp https://www.youtube.com/watch?v=P8OjkcLzYCM
- The
-o
flag is used to download the video to a different directory or to name the download file. To see a list of all the output placeholders, read this documentation.
You can add
~\
at the start of-o
as a shortcut to your home directory (eg. C:\Users\anon). Using.\
will save it to the current directory of the Command Prompt.
Using the filename
[%(uploader)s][%(upload_date)s] %(title)s (%(id)s).%(ext)s
is preferred when gathering large amounts of video as it makes the video files more searchable.
-
The
--write-thumbnail
flag is used to save the thumbnail as an image file and the--write-description
flag to save the description as a.description
file. -
The
--embed-thumbnail
flag is used to embed the original thumbnail of the video into the downloaded video file.--embed-subs
is used to embed subtitles from YouTube into the video file, this is useful for music videos.
--embed-thumbnail
will show the thumbnail as file preview if your file explorer supports it
- The
--embed-metadata
flag is used to add metadata to the video file which is a nice way to save the description without the need of an additional file
The description will be saved as
Comment
to view or copy it open the files propeties and then go to the datails tab
-
--merge-output-format mp4
is used to output an.mp4
file instead of an.mkv
file. -
The
-r
flag is used to throttle the download rate so it does not use up all your bandwidth. 100K = 100KB/s, 1M = 1MB/s (eg. -r 10M to limit download rate to 10MB/s)
Warning! Do not confuse MB/s with Mbps! Read about it here.
-
The
-N
flag is used to state the amount of threads to use when downloading fragments. Higher count will result in faster downloads but do not set it above 16 as it does nothing much past that point. -
The
-S
flag is used to sort video and audio formats to use from first to last order. It is has a lot of options that you can read about here.
It is recommended to use
-S quality,res,fps,proto,codec:vp9.2
as it fixes issues with broken video downloading and playback, see here
- The flags can be combined to form a single command. Example:
yt-dlp https://www.youtube.com/watch?v=P8OjkcLzYCM --merge-output-format mp4 --embed-metadata --embed-thumbnail --embed-subs -S "quality,res,fps,proto,codec:vp9.2" -r 10M -o "[%(uploader)s][%(upload_date)s] %(title)s (%(id)s).%(ext)s"
Downloading playlists
- Download a playlist to the current directory
yt-dlp https://www.youtube.com/playlist?list=PLZ34fLWik_iAP2AdGLOHthUhAJTrEXqGb
-
You can use the
%(playlist_index)s
placeholder in-o
to have the video names ordered according to the playlist order. -
You can use the
%(playlist)s
placeholder to create a folder with the same name as the playlist. -
The
--download-archive
flag saves a list of downloaded videos so that if you decide to update the downloaded playlist in the future it will not redownload the videos listed. -
To download all playlists from a channel, simply copy the channel's URL and add
/playlists
at the end. Unfortunately if used with--download-archive
, any video that shows up more than once in different playlists will only be downloaded to the playlist with the first download of that video.: -
The flags can be combined to form a single command. Example:
yt-dlp https://www.youtube.com/playlist?list=PLZ34fLWik_iAP2AdGLOHthUhAJTrEXqGb --merge-output-format mp4 --embed-metadata --embed-thumbnail --embed-subs -r 10M --download-archive ".\%(playlist)s\playlist.txt" -o ".\%(playlist)s\%(playlist_index)s - [%(uploader)s][%(upload_date)s] %(title)s (%(id)s).%(ext)s"
Downloading members only videos
Make sure you have membership of the channel and are logged into YouTube or it will not work.
- Install the extension
cookies.txt
for Firefox or for Chrome. This will let us extract your cookies from YouTube which will be used to authenticateytarchive
. - Open Youtube then click on the
cookies.txt
extension in the top right hand corner of the browser and click theExport ↓
button to save the cookies. Move the file to a location of your choice.
Do not share your cookie file with anyone unless you know what you're doing! They can have complete access to your YouTube Account.
- Add
--cookies C:\Path\To\youtube.com_cookies.txt
at the end of any command and replaceC:\Path\To\youtube.com_cookies.txt
with the path to your cookie file. Example:
yt-dlp https://www.youtube.com/watch?v=_VcYd4EkBR0 --cookies C:\Users\anon\Desktop\youtube.com_cookies.txt
You may find that sometimes authentication will fail. This is most likely due to old cookies which can be caused by logging out. Simply repeat step 2 to replace your current cookie file.
Setting-up a default config
If you find yourself using the same flags 99% of the time, you can choose to set-up a default config so that you do not need to type the flags you always use.
- Go to your appdata
- Open the start menu by pressing the ⊞ windows key, type
%APPDATA%
and clicking on the folder.
- Open the start menu by pressing the ⊞ windows key, type
- Make a new folder with the name
yt-dlp
- Create a text file in the folder created with the name
config.txt
- Edit the
config.txt
file with your desired flags. Feel free to refer to this example config.txt that has commonly-used flags. - Download videos with ease in the future.
Downloading entire channels
There is a script to simplify the process of downloading an entire channel which you can find here.
Downloading livestreams
Livestreams can be downloaded as they are airing.
This is useful for no archive livestreams or scheduled livestreams.
Refer to this guide.
Content Sharing
The Most Convinient way to share content is by using cloud storage i will list a few providers here
Storage Provider | Free Storage | Recommended Paid Plan | Notes |
---|---|---|---|
Gofile.io | Unlimited (Temporary) | None | Files on gofile get deleted after 10 days of inactivity, Great if you don't have much space since you can watch videofiles directly on the website |
Mega.nz | 20GB | Pro I (10$/M) | Fast,Easy has a build in Videoplayer and a CLI Tool but not recommended for big files as there is a download limit (~5GB) for normal user |
Google Drive | 15GB | 2TB (10$/M) | Can't say much to this, great storage provider besides the Unknown Traffic limit and compression on the filepreview |
Youtube | Unlimited | - | Not cloud storage but a good alternative if you don't care about the quality loss |
HoloTools/HoloStats
Holo Tools and HoloStats are amazing to keep track of all the ongoing livestreams in hololive
You can see all the running,upcoming and recently ended streams of all hololive channels https://hololive.jetri.co (HoloTools) https://holo.poi.cat (HoloStats)
HoloTools updates thumbnails so if a stream gets unavailable you can see it
HoloStats doesnt do that this way you can get the thumbnail even when the stream gets deleted it also shows how long a stream was
Troubleshooting/FAQ
'xxxx' is not recognized as an internal or external command, operable program or batch file
When I run a command in Command Prompt, I get - Try reopening a new Command Prompt in administrator mode and verify if they work.
- Make sure you followed the instructions and installed everything correctly.
- Try adding
.exe
behind the command (eg.ytarchive.exe
instead ofytarchive
).
How do I get the highest quality video and audio available?
New versions of yt-dlp will automatically pick the best quality available without any extra command options.
I get a "Conversion failed!" error from FFmpeg
- There is an issue with newer FFmpeg releases when there is a different protocol for audio and video.
- FFmpeg versions before 3.1.4 do not have this issue.
- you can fix this by using
-S quality,res,fps,proto,codec:vp9.2
which will prefer https+avc over dash+vp9 or use--extractor-args "youtube:skip=dash"
to completly ignore dash formats
How do I do stuff not mentioned here?
Read the docs.