4 ms·
Definitely not a web server. There's no networking code. More like sed. x=https://news.ycombinator.com/item?id links -dump $x=33054601|sed -n '10,43s/.
by 1vuio0pswjnm7 3y ago
Definitely not a web server. There's no networking code. More like sed.
x=https://news.ycombinator.com/item?id
links -dump $x=33054601|sed -n '10,43s/.\{8\}//p' > 045.l
flex -8Crf 045.l
cc -O3 -std=c89 -W -Wall -pedantic -pipe lex.yy.c -static -o yy045
strip -s yy045
# make sql db of search results, excluding any "suggested videos"
x(){ openssl s_client -connect youtube.com:443 -ign_eof|yy045;}
x(){ bssl client -connect youtube.com:443|yy045;}
echo|yy078 s|sqlite3 1.db
echo =querystring|yy076|x \
|yy082 v|sort|uniq|yy076|x \
|yy078 sql|grep -i "querystring"|sqlite3 1.db
sqlite3 1.db .d
# make csv of videos at a channel
echo =querystring|yy076|x \
|yy082 c|sort|uniq > channels.txt
sed 1q channels.txt|yy076|x \
yy078 csv|grep -i "quarystring" > 1.csv
# make html to watch video in browser with javascript disabled
echo select vid from t1|sqlite 1.db|yy076|x|yy079 > 1.html
firefox ./1.html
The above examples only fetch a small number of search results for "querystring" and a partial list of videos at a channel.
The full number of search results may be hundreds or thousands. There may be many more videos listed at a channel.
If want all the search results or the full list of videos at a channel then I use "yy082 t" in a loop, something like the following.
# 127.0.0.255 is fwd proxy address
x(){ nc -vvn 127.255 80|yy045;};
x(){ tcpclient -RHDl0 127.0.0.255:80 sh -c "sed >&6;yy045 <&7";};
x(){ socat stdio,ignoreeof tcp:127.0.0.255:80|yy045;};
x(){ bssl client -connect 127.0.0.255:443 2>/dev/null|yy045;};
x(){ openssl s_client -connect 127.0.0.255:443 -ign_eof 2>/dev/null|yy045;};
out(){ tmux saveb -b YT /dev/stdout;};
inn(){ tmux loadb -b YT /dev/stdin;};
case $1 in :)
;;v|c)
MAX=100;
n=0;while true;do
if test $n -eq 0;then
yy076|x|inn
out|yy082 $1
fi
test $n -le $MAX||break
out|yy082 t|grep -q [A-Z]||break
out|yy082 t|yy076|x|inn;
out|yy082 $1
n=$((n+1));
done|sort|uniq
;;p)
yy082 p|yy076|x|yy082 v|sort|uniq
;;zst)
yy076|x|zstd -19
;;csv)
yy076|x|yy078 c $2
;;htm)
yy076|x|yy079
;;sql)
yy076|x|yy078 s
;;*)
exec echo "
usage: echo =query|${0##*/} {v,c} > {videoids,channelids}
usage: ${0##*/} {zst,csv,htm,sql} < videoids > {1.zst,1.csv,1.htm,1.sql}
less -SN 1.csv
firefox ./1.htm
sqlite3 1.db < 1.sql
zstd -dc 1.zst|yy079 > 1.htm
zstd -dc 1.zst|yy078 {c,s} > {1.csv,1.sql}
zstd -dc 1.zst|yy082 {b,c,h,p,t,v} > {canonicalbaseurls,channelids,watchurls,playlistids,tokens,videoids}
usage: ${0##*/} sql < videoids|sqlite3 1.db
usage: echo =query|${0##*/} c > channelids
usage: sed -n 30{p\;q} channelids|${0##*/} v|${0##*/} sql|sqlite3 1.db
usage: zstd -dc 1.zst|${0##*/} p > videoids
"
esac