4 ms·
"Any way this could be done without requiring Javascript?" Could be done many ways. Lets imagine you like text, you dont mind reading something somewhat struc
by aplorbust 9y ago
"Any way this could be done without requiring Javascript?"
Could be done many ways.
Lets imagine you like text, you dont mind reading something somewhat structured and regular like json and you dont need all the html, css, etc. tags and window dressing.
5-minute quick and dirty solution
1.
curl -4o 1.htm http://jsomers.net/hn/stories.json http://jsomers.net/hn/stories.json
tr , '\12' < 1.htm \
|exec sed '
1i\
<pre>
/./{
/{\"/,/}/!d;
}
/\"url\":[^{]/{s/\"url\":/&<\/pre><a href=/;s/$/>[FETCH]<\/a><pre>/;};
/\"objectID\":/{s//&<\/pre><a href=https:\/\/news.ycombinator.com\/item?id=/;s/$/>[FETCH COMMENTS]<\/a><pre>/;s/\"//3;s/\"//3;};
s/{\"created_at\":/\
\
&/g;
/}}}/s/$/\
\
-----------------/g;
$a\
<\/pre>
' > 2.htm
2.
Navigate to file:///2.htm