#!/bin/bash
# ===========================================
# YouTube 播放列表后台下载脚本（原始 m4a 音频）
# ===========================================

PLAYLIST_URL="https://www.youtube.com/playlist?list=PLxak_2LR4viV1hSo7zdEy4H2FfkRDoFWH"
LOGFILE="yt-dlp-download.log"
SAVE_DIR="/data/www/html/yt-dlp"

mkdir -p "$SAVE_DIR"

/usr/local/bin/yt-dlp \
  -f bestaudio[ext=m4a] \
  --ignore-errors --continue --no-overwrites \
  --retries infinite \
  -o "$SAVE_DIR/%(playlist_index)03d - %(title)s.%(ext)s" \
  "$PLAYLIST_URL"
