alias cnnrss {
if ($1 !isnum 1-) {
echo -ac info * /cnnrss: must specify number of recent headlines
return
}
var %t = $ticks, %rss = rss $+ %t, %nodecol = nodecol $+ %t, %item = item $+ %t
var %children = children $+ %t, %cmd = $iif($2,$2-,echo -a), %tmp
.comopen %rss Msxml2.DOMDocument
if ($comerr) return COM Error
%tmp = $com(%rss,async,4,bool,false)
%tmp = $com(%rss,load,1,bstr*,http://rss.cnn.com/rss/cnn_latest.rss)
.comclose %rss $com(%rss,selectnodes,1,bstr*,/rss/channel/item,dispatch* %nodecol)
var %i = 1, %ii = $comval(%nodecol,0)
while (%i <= $1) && (%i <= %ii) {
%tmp = $com(%nodecol,item,1,uint,%i,dispatch* %item)
if ($com(%item)) {
.comclose %item $com(%item,childnodes,3,dispatch* %children)
if ($com(%children)) {
%cmd %i - $comval(%children,1,text) ** $deltok($comval(%children,2,text),-1,63)
.comclose %children
}
}
inc %i
}
.comclose %nodecol
}