data matches 'https?://www.youtu(.be/|be.com/watch\?v=)[^ ]+' plumb start yt $data data matches '[^ ]+' data matches '.*\.mp4' arg isfile $data plumb start window -dx 648 -dy 368 treason $file ; cat /bin/yt #!/bin/rc # yt: download a video from youtube rfork e itag=18 # default 360p mp4 if(~ $1 -i){ itag=$2 shift shift } switch($#*){ case 2 f=$2 case 1 f=/tmp/yt/^`{echo $1 | sed 's/.*v=([0-9A-Za-z]+).*/\1/'}^.mp4 case * echo 'usage: yt [-i itag] url [dest]' >[1=2] exit usage } hget $1 |urlencode -d |urlencode -d |tr " $nl |sed -n ' s/\\\\u0026/\&/g s/\\//g s/.*(https?:\/\/.*googlevideo.*itag='^$itag^'.*)/dl ''\1'' $f/p ' |rc ; cat /bin/dl #!/bin/rc if(! ~ $#* 2){echo usage: dl url dest >[1=2]; exit usage} hget $1 | tput -p > $2 |[2] aux/statusmsg -kw0,416,9000,524 $2 ; webpaste /dev/text