Tested on Linux
Requires tr, sed, grep, netcat, curl
List of itags https://gist.github.com/sidneys/7095afe4da4ae58694d128b1034e01e2
Works for non-commercial videos
Will not work for commercial videos, e.g., popular music videos
Usage: Run the script then navigate to PAGE1
firefox ./0.html
#!/bin/sh
IP=10.0.0.1;
PORT1=8000;
PORT2=8001;
WAIT=4;
PAGE1=0.htm;
PAGE2=1.htm;
#optional: for use with original nc, create an empty file $NETCATKEEPALIVE to keep script running continuously - Ctrl-C or remove file to stop script NETCATKEEPALIVE=.ncka;
printf '<form method=post id=1 action=http://'$IP':'$PORT1' enctype=text/plain><h3>YouTube without JavaScript</h3>URL<br><textarea form=1 name=c cols=30 placeholder=https://www.youtube.com/watch?v=puJePACBoIo autofocus></textarea><br>ITAG <input name=t type=text value=22 size=1><br><input type=submit></form>' >$PAGE1;_s(){ sed 's/^/url=/'|curl -sK- 2>/dev/null;}; _y(){ b=$(exec sed ' s/http:/https:/; s/m.youtube/www.youtube/; s/youtu.be./www.youtube.com\/watch?v=/; s/hooktube.com/youtube.com/; s/embed./watch?v=/; s/&.//; #etc.; s/?version.//; s/;.//; '); c=${b##=}; a=$(echo "$b"|_s|exec grep -o "https[^\"]"|exec sed -e "/itag=$1/!d;s/..u0026/\&/g" -e "s,\\\,,g"); test x$a != x""|| a=$(echo "$b"|_s|exec grep -o "https[^\"]videoplayback[^\"\\]itag[^\"\\]*"|sed "/itag%3D$1/!d;s/%26/\&/g;s/%3D/=/g;s/%3A/:/g;s/%2F/\//g;s/%3F/?/g;s/%25/%/g"); echo "$a"; }; printf 'http/1.0 302 ok\r\ncontent-Type: text/html\r\nconnection: close\r\nlocation: ' >$PAGE2; printf 'HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n<meta http-equiv=refresh content="'$WAIT';http://'$IP':'$PORT2'">wait '$WAIT''|nc -q15 -lp $PORT1|sed '/[ct]=/!d;s/[ct]=//'|tr -d '\r'|tr '\n' '\040'|{ read URL ITAG;echo $URL|_y $ITAG >>$PAGE2;}; printf '\r\n\r\n' >>$PAGE2; nc -q15 -lp $PORT2 < $PAGE2 >/dev/null; test -f $NETCATKEEPALIVE||exit; $0