diff options
author | kaa <kaa@disroot.org> | 2025-07-29 23:51:08 -0700 |
---|---|---|
committer | kaa <kaa@disroot.org> | 2025-07-29 23:51:08 -0700 |
commit | 6301279036db4efe914ca5078481e20417229b60 (patch) | |
tree | 83e1d4701de9e392b2c633d52cb5c8f21efd9c1f |
init
-rw-r--r-- | readme | 3 | ||||
-rwxr-xr-x | ytpoll | 54 |
2 files changed, 57 insertions, 0 deletions
@@ -0,0 +1,3 @@ +No more web browser, me happy. +I come home, and new videos are waiting for me. +Keep n low. @@ -0,0 +1,54 @@ +#!/bin/sh + +# Channel URLs separated by spaces +channels="https://www.youtube.com/channel/UCsvn_Po0SmunchJYOWpOxMg" +# 720p60fps av1 codec +vq=398 +# Best quality audio opus codec +aq=251 +# output directory +out=$HOME/vid/yt +# number of latest videos +n=10 + +# internal use +tmp=/tmp/ytpoll + +index() +{ + channel=$1 + yt-dlp --flat-playlist -J $channel > $tmp +} + +dl() +{ + video=$1 + + # 20250729 How I Met Goldilocks rg344jf29.webm + yt-dlp -o "$out/%(channel)s/%(upload_date)s %(fulltitle)s %(id)s.%(ext)s" -o "thumbnail:$out/%(channel)s/%(upload_date)s %(fulltitle)s %(id)s.%(ext)s" -o "description:$out/%(channel)s/%(upload_date)s %(fulltitle)s %(id)s.%(ext)s" --write-sub --write-auto-sub --sub-lang "en.*" --write-thumbnail --write-description --embed-metadata --embed-subs -f $vq+$aq $video +} + +check() +{ + < $tmp jq -c '.entries[]' | head -$n | jq -c '.url, (.thumbnails | .[length - 1].url)' | paste - - | tr -d \" | while read -r video + do + url=$(echo $video | sed -e 's| .*||') + dl $url + done +} + +while [ 1 ] +do + date + + for channel in $channels + do + index $channel + check + done + + date + + # 4 hour delay + sleep 14400 +done |