3 ms·
Blogger.com blogs such as this one ("programminggroundup") can be obtained in a single file containing all posts. Text or minimal HTML file. No gratuitous Java
by gwu78 10y ago
Blogger.com blogs such as this one ("programminggroundup") can be obtained in a single file containing all posts. Text or minimal HTML file. No gratuitous Javascript and no comment spam.
See http://news.ycombinator.com/item?id=6845367 http://news.ycombinator.com/item?id=6845367
Simple, portable shell script. Not perfect, but it still works. ^M means Ctrl-V,Ctrl-M in ed/ex/vi
#!/bin/sh
# requirements:
# netcat
# openssl
# sed
# optional: strings
# optional: addcr
type strings 2>&1 >/dev/null ||
strings(){ sed ;}
type addcr 2>&1 >/dev/null ||
addcr(){ sed ;}
[ $# -gt 0 ]||exec echo usage: $0 nameofblog
{
printf "GET / HTTP/1.0\r\n";
printf "Host: $1.blogspot.com\r\n";
printf "Connection: Close\r\n";
printf "\r\n";
} \
|exec nc -vv www.blogger.com 80 \
|exec sed '
s/\\046/\&/g;
s/\\46/\&/g;
s/\\075/=/g;
s/\\75/=/g;
/targetBlogID/!d;
s/.*targetBlogID=//;
s/&.*//;
' |exec sed 1q \
|while read a
do
{
printf "%b" "GET /feeds/$a/posts/default HTTP/1.1\r\n";
printf "Host: www.blogger.com\r\n";
printf "Connection: Close\r\n";
printf "\r\n";
}
done \
|openssl s_client -ign_eof -connect \
www.blogger.com:443 -verify 9 \
|exec addcr \
|{
echo
sed '
s/</</g;
s/>/>/g;
s/&/\&/g;
s/"/\"/g;
1i\
<br><br>
s/<name>/<br><br>name &/g;
s/<uri>/<br>uri &/g;
s/<generator>/<br>generator &/g;
s/Blogger//;
s/<id>/<br>id &/g;
s/<published>/<br>published &/g;
s/<email>/<br>email &/g;
s/<title type=.text.>/<br><br>&/g;
s/<openSearch:totalResults>/<br>total results &/g;
s/<openSearch:startIndex>/<br>start index &/g;
s/<openSearch:itemsPerPage>/<br>items per page &/g;
s/<updated>/<br>updated &/g;
s/<thr:total>/<br>thr:total &/g;
s/<\/feed>/&<br><br><br>/;
s/^M*/<br>/;
' \
|strings
}