Skip to content

Commit 10e435b

Browse files
committed
Add downloader for YouTube playlist data
1 parent 566d1bd commit 10e435b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

zsh/custom/video.zsh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,16 @@ monitorconf() {
4444
;;
4545
esac
4646
}
47+
48+
yt-dlp-playlist() {
49+
if [ $# -ne 1 ]; then
50+
echo "Usage: yt-dlp-playlist <playlist url>"
51+
fi
52+
TITLE="$(yt-dlp --skip-download --print playlist_title --no-warnings "${1}" -I "1:1")"
53+
echo "Downloading playlist data: ${TITLE}"
54+
echo "Downloading data as txt:"
55+
yt-dlp -s --flat-playlist --print-to-file "%(url)s # %(title)s" "%(playlist_title)s.txt" "${1}"
56+
echo "Downloading data as json:"
57+
yt-dlp --dump-single-json --skip-download --no-warnings "${1}" > "${TITLE}.json"
58+
echo "Playlist data downloaded."
59+
}

0 commit comments

Comments
 (0)