diff options
| author | kaa <kaa@disroot.org> | 2025-07-30 22:33:26 -0700 | 
|---|---|---|
| committer | kaa <kaa@disroot.org> | 2025-07-30 22:33:26 -0700 | 
| commit | c4c2fb20e7c07aacfa176b0e3328574f271abeb3 (patch) | |
| tree | e5731def80b2946700ce0c04c1275826f061685d | |
| parent | 8a0a76d4170fc6ad75e49477dae706d797c2c2ac (diff) | |
quoting, reality
| -rwxr-xr-x | ytpoll | 17 | 
1 files changed, 12 insertions, 5 deletions
@@ -1,18 +1,23 @@  #!/bin/sh  # Channel URLs separated by spaces -channels="https://www.youtube.com/channel/UCsvn_Po0SmunchJYOWpOxMg" +channels="https://www.youtube.com/channel/UCsvn_Po0SmunchJYOWpOxMg https://www.youtube.com/channel/UCusoqN-C8Bj9LvROvrl7nJA"  # 720p60fps av1 codec  vq=398  # Best quality audio opus codec  aq=251  # output directory -out=$HOME/vid/yt +out=$HOME/tmp/bank/vid/yt  # number of latest videos  n=10  # internal use  tmp=/tmp/ytpoll +wrk=/tmp/ytpoll_wrk +if ! [ -d $wrk ] +then +	mkdir $wrk +fi  index()  { @@ -25,19 +30,21 @@ 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 +	yt-dlp -o "$wrk/%(channel)s/%(upload_date)s   %(fulltitle)s   %(id)s.%(ext)s" -o "thumbnail:$wrk/%(channel)s/%(upload_date)s   %(fulltitle)s   %(id)s.%(ext)s" -o "description:$wrk/%(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 +	mv $wrk/* $out  }  check()  {  	# Get channel name  	channel="$(< $tmp jq -c '.channel' | tr -d \")" -	< $tmp jq -c '.entries[]' | head -$n | jq -c '(.url, .id)' | paste - - | tr -d \" | while read -r video +	< $tmp jq -c '.entries[].entries[]' | head -$n | jq -c '(.url, .id)' | paste - - | tr -d \" | while read -r video  	do  		# check without accessing YT if video is downloaded  		url=$(echo $video | sed -e 's| .*||')  		id=$(echo $video | sed -e 's|.* ||') -		if ! [ -f $out/$channel/*$id.webm ] +		ls "$out"/"$channel"/*"$id".webm 1>/dev/null 2>/dev/null 3>/dev/null +		if [ $? -ne 0 ]  		then  			dl $url  		fi  | 
