Skip to content

Commit 4b371ad

Browse files
committed
Initial version
1 parent a4f91bc commit 4b371ad

15 files changed

+285
-0
lines changed

README.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Sensible yt-dlp Archive Scripts
2+
3+
I often get asked what yt-dlp scripts I use for my archives. I've not been satisfied with other scripts I've found online, so I decided to make this repo to share scripts that are the best *in my opinion*.
4+
5+
Let me know if something doesn't work correctly or you run into any issues :).
6+
7+
Also check out the [official README](https://github.com/yt-dlp/yt-dlp) if you have any questions about yt-dlp itself.
8+
9+
10+
## yt-dlp installation
11+
12+
These are the installation methods I recommend, **however you can install yt-dlp any way you want**. After installation, you should be able to run yt-dlp by just typing `yt-dlp` into your terminal.
13+
14+
These commands also install ffmpeg and aria2, which yt-dlp uses for merging files and downloading faster.
15+
16+
For more information about installation, please read the [official README](https://github.com/yt-dlp/yt-dlp#installation).
17+
18+
### Windows
19+
20+
In PowerShell (run as administrator):
21+
22+
```
23+
# Install Chocolatey for package management
24+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
25+
26+
choco install -y python3
27+
choco install -y ffmpeg
28+
choco install -y aria2
29+
30+
# Run a new PowerShell window here
31+
32+
python -m pip install -U yt-dlp
33+
# If module pip is not found, run this first:
34+
# python -m ensurepip
35+
```
36+
37+
### Mac OS
38+
39+
```
40+
# install Homebrew for package management
41+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
42+
43+
brew install python3
44+
brew install ffmpeg
45+
brew install aria2
46+
47+
python3 -m pip install -U yt-dlp
48+
# If module pip is not found, run this first:
49+
# python3 -m ensurepip
50+
```
51+
52+
### Linux (debian)
53+
54+
```
55+
sudo apt-get install -y python3 ffmpeg aria2
56+
python3 -m pip install -U yt-dlp
57+
# If module pip is not found, run this first:
58+
# python3 -m ensurepip
59+
```
60+
61+
62+
## Updating yt-dlp
63+
64+
Updating yt-dlp is as simple as running `python3 -m pip install -U yt-dlp` (Linux/MacOS) or `python -m pip install -U yt-dlp` (Windows). You can also install the latest master (development version) by running `python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz`.
65+
66+
67+
## Using scripts
68+
69+
1. Clone this repo using git, or download it as a zip from [here](https://github.com/rebane2001/sensible-yt-dlp-archive-scripts/archive/refs/heads/mane.zip).
70+
2. Open the included yt-dlp.conf file from the scripts folder for your OS with any text editor, read through it and make changes if you wish. Commented lines start with #, which you must remove for configuration options you wish to enable.
71+
3. Open the script file you want to use with any text editor, read through it and make changes if you wish.
72+
4. Put your urls in the the script's .txt file.
73+
5. Run the script (`bash script_name.sh` in Linux/MacOS, double-click the bat file in Windows).

scripts/linux-osx/archive_channels.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This script downloads every channel linked in channels.txt.
2+
# Videos will be saved in "channels/channel_name (channel_id)/YYYY-MM-DD - video_title - video_id.ext".
3+
# Channel and video names will be limited to max 200 characters to prevent issues.
4+
# List of downloaded video IDs will be kept in channels_downloaded.txt.
5+
# Uncomment the loop if you want to keep this running constantly.
6+
7+
# while true; do
8+
yt-dlp --config-locations "./yt-dlp.conf" \
9+
--download-archive "channels_downloaded.txt" \
10+
--batch-file="channels_input.txt" \
11+
--output "channels/%(uploader).200s (%(uploader_id)s)/%(upload_date)s - %(title).200s - %(id)s.%(ext)s"
12+
# sleep 300
13+
# done
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This script downloads every playlist linked in playlists.txt.
2+
# Videos will be saved in "playlists/playlist_id - playlist_title/YYYY-MM-DD - video_title - video_id.ext".
3+
# Playlist and video names will be limited to max 200 characters to prevent issues.
4+
# List of downloaded video IDs will be kept in playlists_downloaded.txt.
5+
# Uncomment the loop if you want to keep this running constantly.
6+
7+
# while true; do
8+
yt-dlp --config-locations "./yt-dlp.conf" \
9+
--download-archive "playlists_downloaded.txt" \
10+
--batch-file="playlists_input.txt" \
11+
--output "playlists/%(playlist_id)s - %(playlist_title)s.200s/%(upload_date)s - %(title).200s - %(id)s.%(ext)s"
12+
# sleep 300
13+
# done

scripts/linux-osx/archive_videos.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This script downloads every channel, playlist, and video linked in videos.txt.
2+
# Note that this script is pretty much the same as the channels script, just slightly modified to fit this use case better.
3+
# Videos will be saved in "videos/channel_name (channel_id)/YYYY-MM-DD - video_title - video_id.ext".
4+
# Channel and video names will be limited to max 200 characters to prevent issues.
5+
# List of downloaded video IDs will be kept in videos_downloaded.txt.
6+
# Uncomment the loop if you want to keep this running constantly.
7+
8+
# while true; do
9+
yt-dlp --config-locations "./yt-dlp.conf" \
10+
--download-archive "videos_downloaded.txt" \
11+
--batch-file="videos_input.txt" \
12+
--output "videos/%(uploader).200s (%(uploader_id)s)/%(upload_date)s - %(title).200s - %(id)s.%(ext)s"
13+
# sleep 300
14+
# done

scripts/linux-osx/channels_input.txt

Whitespace-only changes.

scripts/linux-osx/playlists_input.txt

Whitespace-only changes.

scripts/linux-osx/videos_input.txt

Whitespace-only changes.

scripts/linux-osx/yt-dlp.conf

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# This is the base configuration used for the other scripts.
2+
# Look through it and comment/uncomment lines according to how you want them.
3+
4+
# Use cookies to bypass things such as age-restrictions and paid/member content.
5+
#--cookies cookies.txt
6+
7+
# Not using ipv6 can sometimes prevent 429 bans.
8+
#--force-ipv4
9+
10+
# Sleeping between requests prevents 429 bans.
11+
--sleep-requests 1.5
12+
13+
# Verbose output
14+
--verbose
15+
16+
# If errors are not ignored, downloading playlists/channels
17+
# stops on an error, which means the rest won't be downloaded
18+
# if one video is deleted/privated, or otherwise broken.
19+
--ignore-errors
20+
21+
# Write useful metadata
22+
--write-info-json
23+
--write-description
24+
--write-thumbnail
25+
--write-sub
26+
27+
# Embed metadata into file, I personally don't recommend these.
28+
#--embed-subs
29+
#--embed-thumbnail
30+
#--embed-metadata
31+
#--embed-chapters
32+
#--embed-info-json
33+
34+
# Write all normal subtitles and live chat.
35+
--sub-langs all
36+
37+
# For no live chat, use this instead.
38+
#--sub-langs all,-live_chat
39+
40+
# To also download auto-generated and auto-translated subtitles.
41+
# Not recommended because these downloads are pretty slow.
42+
--write-auto-subs
43+
44+
45+
# The default format selection/sorting of yt-dlp is excellent,
46+
# so use these flags only if you need them.
47+
48+
# Download only as mp4.
49+
#--format bestvideo[ext=mp4]+bestaudio[ext=m4a]
50+
51+
# Download only as mp4 if possible, otherwise download the best available.
52+
#--format bestvideo[ext=mp4]+bestaudio[ext=m4a]/bv*+ba/b
53+
54+
# Download only the audio.
55+
#--format bestaudio
56+
57+
# Download only the audio as mp3.
58+
#--format bestaudio
59+
#--extract-audio
60+
#--audio-format mp3
61+
62+
63+
# Always save output as mkv.
64+
#--merge-output-format mkv
65+
66+
# Use aria2c for downloads. Comment if you don't have aria2 installed.
67+
--external-downloader aria2c
68+

scripts/windows/archive_channels.bat

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:: This script downloads every channel linked in channels.txt.
2+
:: Videos will be saved in "channels/channel_name (channel_id)/YYYY-MM-DD - video_title - video_id.ext".
3+
:: Channel and video names will be limited to max 200 characters to prevent issues.
4+
:: List of downloaded video IDs will be kept in channels_downloaded.txt.
5+
:: Uncomment the loop if you want to keep this running constantly.
6+
7+
:: :loop
8+
yt-dlp --config-locations ".\yt-dlp.conf" ^
9+
--download-archive "channels_downloaded.txt" ^
10+
--batch-file="channels_input.txt" ^
11+
--output "channels/%%(uploader).200s (%%(uploader_id)s)/%%(upload_date)s - %%(title).200s - %%(id)s.%%(ext)s"
12+
:: goto loop

scripts/windows/archive_playlists.bat

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:: This script downloads every playlist linked in playlists.txt.
2+
:: Videos will be saved in "playlists/playlist_id - playlist_title/YYYY-MM-DD - video_title - video_id.ext".
3+
:: Playlist and video names will be limited to max 200 characters to prevent issues.
4+
:: List of downloaded video IDs will be kept in playlists_downloaded.txt.
5+
:: Uncomment the loop if you want to keep this running constantly.
6+
7+
:: :loop
8+
yt-dlp --config-locations ".\yt-dlp.conf" ^
9+
--download-archive "playlists_downloaded.txt" ^
10+
--batch-file="playlists_input.txt" ^
11+
--output "playlists/%%(playlist_id)s - %%(playlist_title)s.200s/%%(upload_date)s - %%(title).200s - %%(id)s.%%(ext)s"
12+
:: goto loop

scripts/windows/archive_videos.bat

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:: This script downloads every channel, playlist, and video linked in videos.txt.
2+
:: Note that this script is pretty much the same as the channels script, just slightly modified to fit this use case better.
3+
:: Videos will be saved in "videos/channel_name (channel_id)/YYYY-MM-DD - video_title - video_id.ext".
4+
:: Channel and video names will be limited to max 200 characters to prevent issues.
5+
:: List of downloaded video IDs will be kept in videos_downloaded.txt.
6+
:: Uncomment the loop if you want to keep this running constantly.
7+
8+
:: :loop
9+
yt-dlp --config-locations ".\yt-dlp.conf" ^
10+
--download-archive "videos_downloaded.txt" ^
11+
--batch-file="videos_input.txt" ^
12+
--output "videos/%%(uploader).200s (%%(uploader_id)s)/%%(upload_date)s - %%(title).200s - %%(id)s.%%(ext)s"
13+
:: goto loop

scripts/windows/channels_input.txt

Whitespace-only changes.

scripts/windows/playlists_input.txt

Whitespace-only changes.

scripts/windows/videos_input.txt

Whitespace-only changes.

scripts/windows/yt-dlp.conf

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This is the base configuration used for the other scripts.
2+
# Look through it and comment/uncomment lines according to how you want them.
3+
4+
# Use cookies to bypass things such as age-restrictions and paid/member content.
5+
#--cookies cookies.txt
6+
7+
# Not using ipv6 can sometimes prevent 429 bans.
8+
#--force-ipv4
9+
10+
# Sleeping between requests prevents 429 bans.
11+
--sleep-requests 1.5
12+
13+
# Verbose output
14+
--verbose
15+
16+
# If errors are not ignored, downloading playlists/channels
17+
# stops on an error, which means the rest won't be downloaded
18+
# if one video is deleted/privated, or otherwise broken.
19+
--ignore-errors
20+
21+
# Write useful metadata
22+
--write-info-json
23+
--write-description
24+
--write-thumbnail
25+
--write-sub
26+
27+
# Embed metadata into file, I personally don't recommend these.
28+
#--embed-subs
29+
#--embed-thumbnail
30+
#--embed-metadata
31+
#--embed-chapters
32+
#--embed-info-json
33+
34+
# Write all normal subtitles and live chat.
35+
--sub-langs all
36+
37+
# For no live chat, use this instead.
38+
#--sub-langs all,-live_chat
39+
40+
# To also download auto-generated and auto-translated subtitles.
41+
# Not recommended because these downloads are pretty slow.
42+
--write-auto-subs
43+
44+
45+
# The default format selection/sorting of yt-dlp is excellent,
46+
# so use these flags only if you need them.
47+
48+
# Download only as mp4.
49+
#--format bestvideo[ext=mp4]+bestaudio[ext=m4a]
50+
51+
# Download only as mp4 if possible, otherwise download the best available.
52+
#--format bestvideo[ext=mp4]+bestaudio[ext=m4a]/bv*+ba/b
53+
54+
# Download only the audio.
55+
#--format bestaudio
56+
57+
# Download only the audio as mp3.
58+
#--format bestaudio
59+
#--extract-audio
60+
#--audio-format mp3
61+
62+
63+
# Always save output as mkv.
64+
#--merge-output-format mkv
65+
66+
# Use aria2c for downloads. Comment if you don't have aria2 installed.
67+
--external-downloader aria2c

0 commit comments

Comments
 (0)