From 1dab330a3838b4ab525641527b5ff4ce3efdf4ea Mon Sep 17 00:00:00 2001 From: juvdiaz Date: Sat, 27 Jun 2026 14:30:28 -0600 Subject: [PATCH] Use Node runtime for YouTube backups --- bootstrap/host/group_vars/debian_pc.yml | 3 ++- bootstrap/host/playbook.yml | 9 +++++++-- infra/youtube-backup/.env.example | 1 + infra/youtube-backup/README.md | 5 ++++- infra/youtube-backup/backup-youtube.sh | 2 ++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bootstrap/host/group_vars/debian_pc.yml b/bootstrap/host/group_vars/debian_pc.yml index 0a234c6..142b660 100644 --- a/bootstrap/host/group_vars/debian_pc.yml +++ b/bootstrap/host/group_vars/debian_pc.yml @@ -28,7 +28,8 @@ debian_pc_enable_services: - bluetooth debian_pc_pipx_packages: - - yt-dlp + - package: "yt-dlp[default]" + app: yt-dlp debian_pc_hold_packages: - containerd.io diff --git a/bootstrap/host/playbook.yml b/bootstrap/host/playbook.yml index 5056671..5020916 100644 --- a/bootstrap/host/playbook.yml +++ b/bootstrap/host/playbook.yml @@ -177,8 +177,13 @@ - name: Install user pipx CLI tools ansible.builtin.command: - cmd: "python3 -m pipx install {{ item }}" - creates: "{{ debian_pc_user_home }}/.local/bin/{{ item }}" + argv: + - python3 + - -m + - pipx + - install + - "{{ item.package }}" + creates: "{{ debian_pc_user_home }}/.local/bin/{{ item.app }}" become: true become_user: "{{ debian_pc_user }}" environment: diff --git a/infra/youtube-backup/.env.example b/infra/youtube-backup/.env.example index 602b489..72e4984 100644 --- a/infra/youtube-backup/.env.example +++ b/infra/youtube-backup/.env.example @@ -15,6 +15,7 @@ YOUTUBE_BACKUP_COOKIES_FROM_BROWSER= YOUTUBE_BACKUP_FORMAT=bv*+ba/best YOUTUBE_BACKUP_MERGE_FORMAT=mp4 YOUTUBE_BACKUP_SUB_LANGS=all,-live_chat +YOUTUBE_BACKUP_JS_RUNTIMES=node YOUTUBE_BACKUP_SLEEP_REQUESTS=1 YOUTUBE_BACKUP_RATE_LIMIT= YOUTUBE_BACKUP_EXTRA_ARGS= diff --git a/infra/youtube-backup/README.md b/infra/youtube-backup/README.md index 3e81efb..7ae160a 100644 --- a/infra/youtube-backup/README.md +++ b/infra/youtube-backup/README.md @@ -13,7 +13,10 @@ 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. +helper. It installs yt-dlp with its default dependency group so the YouTube EJS +challenge scripts are available, and the backup script passes +`--js-runtimes node` by default. On another machine, install those tools before +running the backup. ## Configure diff --git a/infra/youtube-backup/backup-youtube.sh b/infra/youtube-backup/backup-youtube.sh index 15ac424..95d59ac 100755 --- a/infra/youtube-backup/backup-youtube.sh +++ b/infra/youtube-backup/backup-youtube.sh @@ -22,6 +22,7 @@ FORMAT="${YOUTUBE_BACKUP_FORMAT:-bv*+ba/best}" OUTPUT_TEMPLATE="${YOUTUBE_BACKUP_OUTPUT_TEMPLATE:-%(playlist_title)s/%(upload_date>%Y-%m-%d,release_date>%Y-%m-%d,epoch>%Y-%m-%d)s - %(title)s [%(id)s].%(ext)s}" SUB_LANGS="${YOUTUBE_BACKUP_SUB_LANGS:-all,-live_chat}" MERGE_FORMAT="${YOUTUBE_BACKUP_MERGE_FORMAT:-mp4}" +JS_RUNTIMES="${YOUTUBE_BACKUP_JS_RUNTIMES:-node}" RATE_LIMIT="${YOUTUBE_BACKUP_RATE_LIMIT:-}" SLEEP_REQUESTS="${YOUTUBE_BACKUP_SLEEP_REQUESTS:-1}" EXTRA_ARGS="${YOUTUBE_BACKUP_EXTRA_ARGS:-}" @@ -73,6 +74,7 @@ args=( --sub-langs "${SUB_LANGS}" --embed-metadata --embed-thumbnail + --js-runtimes "${JS_RUNTIMES}" --sleep-requests "${SLEEP_REQUESTS}" )