aboutsummaryrefslogtreecommitdiff
path: root/bash/youtube.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bash/youtube.sh')
-rw-r--r--bash/youtube.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/bash/youtube.sh b/bash/youtube.sh
new file mode 100644
index 0000000..b64300d
--- /dev/null
+++ b/bash/youtube.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+export DEFAULT_PLAYLIST_END=15
+
+download() {
+ youtube-dl "$1" \
+ --download-archive ~/annex/txt/youtube-dl-seen.conf \
+ --prefer-free-formats \
+ --playlist-end $2 \
+ --output "~/Downloads/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"
+}
+
+export -f download
+
+download_user() {
+ download "https://www.youtube.com/user/$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_user
+
+download_channel() {
+ download "https://www.youtube.com/channel/$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_channel
+
+download_playlist() {
+ download "https://www.youtube.com/playlist?list=$1" ${2-$DEFAULT_PLAYLIST_END}
+}
+
+export -f download_playlist