User Control Panel
Advertisements

HELP US, HELP YOU!

Rss With Maya Bot

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
rojkind
Newbie
Newbie


Joined: 05 Oct 2005
Posts: 6
Location: NZ
Reputation: 15.7Reputation: 15.7

PostPosted: Tue Jan 16, 2007 12:12 am    Post subject: Rss With Maya Bot Reply with quote

I can get maya to get information from rss for me but i dont know how to configure so that i only get a certain amount of entries not all of them, just say the first five this is my code can someone help me out?

Quote:
use XML::Simple;
use LWP::Simple;

print wired();

sub wired{
my $text;
my $rss = XMLin(get("http://www.wired.com/news/feeds/rss2/0,2610,,00.xml"));
foreach $item (@{$rss->{channel}->{item}}) {
$text .= "$item->{title}\n$item->{link}\n";
}
&send($self,"$text");
}


Any help would be greatly apreciated.

Many Thanks,

Dan
Back to top
rojkind
Newbie
Newbie


Joined: 05 Oct 2005
Posts: 6
Location: NZ
Reputation: 15.7Reputation: 15.7

PostPosted: Tue Jan 16, 2007 4:45 am    Post subject: RSS Reply with quote

Ok...i figured it out myself...i was just being lazy if anyones stuck and you want an rss reader for maya here it is:

Quote:
use XML::Simple;
&send($self,"(O) Please wait while we get the content [from http://www.geekzone.co.nz]");
print rss();
sub rss{
$reply = "Geekzone RSS [http://www.geekzone.co.nz/]\n\n";
$data = XMLin(get('http://www.geekzone.co.nz/geekzone_rss.asp'));
for ($i=0;$i<5;$i++){
$item = @{$data->{channel}->{item}}[$i];
$reply .= $item->{title}."\n".$item->{link}."\n\n";
}
&send($self,"$reply");
};


Hope that helps,

Dan
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group