socket rss help - 10/10/09 02:19 PM
I have a small problem, i got my socket script that reads from rss and then post the latest news, but it seems it only works on a few sites. Here's code:
So far i know all rss feeds have <item>, <title> and <link> in it, so i dont see why it wont work on all sites. Anyone know what i can do to make it work on all rss feeds?
Code:
alias bbc-rss { if ($sock(bbc-rss)) { sockclose bbc-rss } sockopen bbc-rss newsrss.bbc.co.uk 80 } on *:sockopen:bbc-rss: { sockwrite -n $sockname GET /rss/newsonline_world_edition/front_page/rss.xml HTTP/1.1 sockwrite -n $sockname Host: newsrss.bbc.co.uk $+ $crlf $+ $crlf } on *:sockread:bbc-rss: { if ($sockerr) { halt } else { var %s.data sockread %s.data if (<item> isin %s.data) { set %s.item 1 } if (<title> isin %s.data) || (<link> isin %s.data) && (%s.item) { set %d. [ $+ [ $remove($gettok(%s.data,-1,60),$chr(47),$chr(62)) ] ] $remove(%s.data,<title>,</title>,<link>,</link>) } if (%d.title) && (%d.link) { echo -a News: %d.title ยป $+ $remove(%d.link,$chr(32)) $+ unset %s.* %d.* sockclose $sockname } } }
So far i know all rss feeds have <item>, <title> and <link> in it, so i dont see why it wont work on all sites. Anyone know what i can do to make it work on all rss feeds?