67 lines
1.4 KiB
Markdown
67 lines
1.4 KiB
Markdown
# YouTube Backup
|
|
|
|
Standalone helper for backing up your own uploaded YouTube videos with
|
|
`yt-dlp`. It is intentionally outside `lab.sh`, OpenTofu, Argo CD, and the
|
|
homelab deployment pipeline.
|
|
|
|
The backup root defaults to `/data/youtube-backup`.
|
|
|
|
## Install
|
|
|
|
```bash
|
|
pipx install yt-dlp
|
|
```
|
|
|
|
The Debian host bootstrap installs `yt-dlp`, `ffmpeg`, and `nodejs` for this
|
|
helper. On another machine, install those tools before running the backup.
|
|
|
|
## Configure
|
|
|
|
```bash
|
|
sudo mkdir -p /data/youtube-backup/{videos,logs}
|
|
sudo chown -R "$USER:$USER" /data/youtube-backup
|
|
cp infra/youtube-backup/playlists.example.txt /data/youtube-backup/playlists.txt
|
|
cp infra/youtube-backup/.env.example infra/youtube-backup/.env
|
|
```
|
|
|
|
Edit `/data/youtube-backup/playlists.txt` and add one playlist, channel, or
|
|
video URL per line.
|
|
|
|
For private or unlisted uploads, export browser cookies and set:
|
|
|
|
```bash
|
|
YOUTUBE_BACKUP_COOKIES_FILE=/data/youtube-backup/cookies.txt
|
|
```
|
|
|
|
Alternatively, when running on a desktop with a browser profile:
|
|
|
|
```bash
|
|
YOUTUBE_BACKUP_COOKIES_FROM_BROWSER=firefox
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
infra/youtube-backup/backup-youtube.sh
|
|
```
|
|
|
|
The script uses:
|
|
|
|
```text
|
|
--download-archive /data/youtube-backup/archive.txt
|
|
```
|
|
|
|
so repeated runs skip videos that were already backed up.
|
|
|
|
Downloaded videos and sidecar metadata are written under:
|
|
|
|
```text
|
|
/data/youtube-backup/videos
|
|
```
|
|
|
|
Each run also writes a timestamped log under:
|
|
|
|
```text
|
|
/data/youtube-backup/logs
|
|
```
|