ytd - dotfiles - These are my dotfiles. There are many like it, but these are mine.
 (HTM) git clone git://jay.scot/dotfiles
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
       ytd (2275B)
       ---
            1 #!/bin/sh
            2 
            3 # yt-dlp subscription fetcher
            4 # jay <me@jay.scot>
            5 
            6 savepath="$HOME/media/youtube"
            7 cachedir="$HOME/.cache/yt_dl"
            8 yt="yt-dlp"
            9 baseurl="https://www.youtube.com/playlist?list="
           10 ody_url="https://odysee.com/"
           11 
           12 info() {
           13         printf "\033[35mYT ➤\033[36m %s\033[0m\n" "$1"
           14 }
           15 
           16 main() {
           17         mkdir -p "${cachedir}"
           18         mkdir -p "${savepath}"
           19 
           20     action="$1"
           21 
           22         "$action" "steve1989mreinfo" "UU2I6Et1JkidnnbWgJFiMeHA"
           23         "$action" "simon_wilson" "UUQCrKxBj5Id79syQEsY2Qxg"
           24         "$action" "c90adventures" "UUVqpNG1R72i21jh-nAxEk4A"
           25         "$action" "indigo_traveller" "UUXulruMI7BHj3kGyosNa0jA"
           26         "$action" "pppeter" "UUnHEz9DZ6EAof1-DaQGD_Xw"
           27         "$action" "abroad_in_japan" "UUHL9bfHTxCMi-7vfxQ-AYtg"
           28         "$action" "serpentza" "UUl7mAGnY4jh4Ps8rhhh8XZg"
           29         "$action" "the_lazy_peon" "UUE-f0sqi-H7kuLT0YiW9rcA"
           30         "$action" "zav_alsop" "UUcjx6m03fZwtRBFn1Cf7kKQ"
           31         "$action" "steve_marsh" "UUBhQuxcHU3aydk_zTXcbdTg"
           32         "$action" "planes_trains_everything" "UUcKw8Eg0FfRvhIAnC0cPGAA"
           33         "$action" "we_hate_the_cold" "UULmltEyJ0zBsKnL8bWSdn3A"
           34         "$action" "astonishing_glasgow" "UUIDIqg7LhjLFCyD2awY_38g"
           35         "$action" "drain_cleaning_aus" "UU7sGXeJOixPBgJ3r5R55JYg"
           36         "$action" "mike_okay" "UUpp3cHR9TWVyXqL1AVw4XkA"
           37         "$action" "rhykker" "UURl31PWkfF0a3j3hiDRaCGA"
           38         "$action" "brodie_robertson" "UUld68syR8Wi-GY_n4CaoJGA"
           39         "$action" "distrotube" "UUVls1GmFKf6WlTraIb_IaJg"
           40         "$action" "max_roving" "UUOxpcQ7KtZc7fd0jhnWS0Sg"
           41         "$action" "misfit_minds" "UUEpHkpv4_CgZIEadjjOv4jA"
           42         "$action" "better_offline" "UUsdzuPs5NKvdsBkQnP7Af8w"
           43         "$action" "simon_doherty" "UU2smcaU7852QtVvJz48dCRw"
           44         "$action" "phil_carr" "UULva3lkHR6B5OO-eiVaPnDg"
           45         "$action" "andrea_borman" "UUJsinEiaDqEn8a-GcADVEVA"
           46         "$action" "veronica_explains" "UUMiyV_Ib77XLpzHPQH_q0qQ"
           47         "$action" "chubby_trekka" "UU5YskHOZiTEzjdps94jFX1g"
           48         "$action" "bythecurb" "UUUZ68a2OJnyTutbTNG1tSpA"
           49 }
           50 
           51 get_video() {
           52         info "Fetching latest from $1"
           53         mkdir -p "${savepath}/${1}"
           54 
           55         "$yt" -q --restrict-filename \
           56                 --download-archive "${cachedir}/${1}" \
           57                 "${baseurl}${2}" \
           58                 -o "${savepath}/${1}/%(playlist_index)s_%(title)s.%(ext)s"
           59 }
           60 
           61 catchup() {
           62         info "Catching up on $1"
           63         "$yt" --flat-playlist --get-id \
           64                 "${baseurl}${2}" | sed 's/.*/youtube &/' >"${cachedir}/${1}"
           65 }
           66 
           67 case "$1" in
           68 -m)
           69         main catchup
           70         ;;
           71 -n)
           72         catchup "$2" "$3"
           73         ;;
           74 *)
           75         main get_video
           76         ;;
           77 esac