42 lines
932 B
Bash
42 lines
932 B
Bash
|
#!/run/current-system/sw/bin/bash
|
||
|
|
||
|
export DEFAULT_PLAYLIST_END=10
|
||
|
|
||
|
download_single() {
|
||
|
youtube-dl "$1" \
|
||
|
--download-archive "~/Videos/YT/history.conf" \
|
||
|
--prefer-free-formats\
|
||
|
--write-description \
|
||
|
--output "~/Videos/YT/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"
|
||
|
}
|
||
|
export -f download_single
|
||
|
|
||
|
download() {
|
||
|
youtube-dl "$1" \
|
||
|
--download-archive "~/Videos/YT/history.conf" \
|
||
|
--prefer-free-formats\
|
||
|
--playlist-end $2 \
|
||
|
--write-description \
|
||
|
--output "~/Videos/YT/%(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
|
||
|
|
||
|
|
||
|
|
||
|
|