3 ms·
Retrieve, remove indentation, compile, strip x=https://news.ycombinator.com/item?id links -dump $x=37060497 > 1;#|sed -n '6,137{s/.\{6\}//p;}'
by 1vuio0pswjnm7 3y ago
Retrieve, remove indentation, compile, strip
x=https://news.ycombinator.com/item?id
links -dump $x=37060497 > 1;#|sed -n '6,137{s/.\{6\}//p;}' > 076.l
flex -8Crf 076.l
cc -O3 -std=c89 -W -Wall -pedantic -pipe lex.yy.c -static -o yy076
strip -s yy076
Lines in 076.l that must not be indented: 6-16,69,70-72,79,86,93,100,107,114-118,123,124
All other lines must be indented.
- slater 3y ago[flagged]
- fragmede 3y agoflex -8Crf 076.l
- mdwalters 3y agoInteresting. What does this script do? Also, consider making an "Show HN" post for this. :)
- fragmede 3y agoBut I've got yy076 compiled, now what? If I pipe something to it it behaves like a web server; following that, I get to your youtube channel with no videos.
- 1vuio0pswjnm7 3y agoDefinitely 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