aboutsummaryrefslogtreecommitdiff
path: root/bash/youtube.sh
blob: b64300d8425c18387177bb4bd2f2af9665f364af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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