rendered paste body/sockopen digg digg.com 80
ON *:sockopen:digg: {
sockwrite -n $sockname GET /rss/index.xml HTTP/1.1
sockwrite -n $sockname HOST: digg.com $+ $crlf $+ $crlf
}
On *:sockread:digg {
if ($sockerr) {
echo -a Error.
halt
}
else {
if (%poop > 6) { halt }
var %temptext
sockread %temptext
echo %temptext
if (<title>*</title> iswm %temptext ) && ( %poop > 1) {
set %title [ $+ [%poop]] $htmlfree(%temptext)
}
elseif (<link>*</link> iswm %temptext ) && ( %poop > 1) {
set %link [ $+ [ %poop ] ] $htmlfree(%temptext)
}
elseif (<description>*</description> iswm %temptext ) && ( %poop > 1) {
set %description [ $+ [ %poop ] ] $htmlfree(%temptext)
}
inc %poop 1
echo works %poop
}
}
alias -l htmlfree {
; It's local because it won't be used by the command line, only this file.
; Local aliases avoid conflicting names.
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}