shithub: docs.9front.org

Download patch

ref: 4f56c67fda52b2d61cd11cc93a3281217d224eaa
parent: 5752c32df93436ddb74ae198445c422c3fa72501
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Jun 22 16:40:25 EDT 2021

youtube: no more youtubedr

--- a/youtube.md
+++ b/youtube.md
@@ -8,21 +8,11 @@
 or 386.  No videos for Raspi users, sorry.  You can still play audio
 only on other arches though.
 
-Install [youtubedr](https://github.com/ftrvxmtrx/youtube):
+Install [nvi](https://git.sr.ht/~ft/nvi).
 
-	9fs ftrv.se
-	gunzip < /n/ftrv.se/bin/youtubedr.$objtype.gz > $home/bin/$objtype/youtubedr
-	chmod +x $home/bin/$objtype/youtubedr
-	hget https://curl.haxx.se/ca/cacert.pem > /sys/lib/tls/ca.pem
-
-`youtubedr` may fail with "error parsing signature tokens".  Not much
-can be done here until the upstream incorporates some logic that
-`youtube-dl` has.  For now, some of the videos will just fail to
-download. *BUMMER*.
-
 ## Playing just audio alone
 
-	mcfs -t 1 `"{youtubedr download -q 140 -d /tmp -o audio.mp4 ybGOT4d2Hs8} | audio/aacdec > /dev/audio
+	nvi -A 251 -a /fd/1 ybGOT4d2Hs8 | mcfs -t audio | audio/aacdec > /dev/audio
 
 ## Playing video and/or audio
 
@@ -31,35 +21,12 @@
 contains audio in the container itself and doesn't require too much
 CPU resources.
 
-	treason `"{youtubedr download -q 18 -d /tmp -o _vid.mp4 ybGOT4d2Hs8}; rm -f /tmp/_vid.mp4
+	nvi -V 18 -v /tmp/vid.mp4 ybGOT4d2Hs8 && treason /tmp/vid.mp4 && rm /tmp/vid.mp4
 
-If you want to find the best possible format, use the following script:
+If you want to find the best possible format(s), use the following:
 
-	#!/bin/rc
-	rfork ne
-	vitag=`{youtubedr info $"1 | awk '
-		/av01/ {
-			tags[ntags++] = $2
-			if($2 == "398"){ # prefer hd720
-				tags[0] = $2
-				exit
-			}
-		}
-		END {
-			if(ntags > 0)
-				print tags[0]
-		}
-	'}
-	if(~ $#vitag 0)
-		treason `"{youtubedr download -q 18 -d /tmp -o _vid.mp4 $"1}
-	if not
-		treason -a `"{youtubedr download -q 140 -d /tmp -o _aud.mp4 $"1} \
-		           `"{youtubedr download -q $vitag -d /tmp -o _vid.mp4 $"1}
-	#rm -f /tmp/_^(aud vid)^.mp4
+	nvi -a /tmp/audio -v /tmp/video ybGOT4d2Hs8 && treason -a /tmp/audio /tmp/video && rm /tmp/audio /tmp/video
 
-*TODO* This script should be extended to choose best format based on
-preferences (resolution) and CPU resources.
-
 You can put that script to `$home/bin/rc/youtube` and add a plumb rule
 for Youtube URLs, right *before* `include basic`:
 
@@ -69,8 +36,8 @@
 
 ## Caveats
 
-Many. Patches welcome.
+No. It's great.
 
 ## Support
 
-sigrid @ `#cat-v`.
+sigrid @ `#cat-v` or `9gridchan`.