Ok this is part of a bot i'm working and have decided
to release this part as an RSS Bot for the GSO community.
You can add your triggers down on the commands section
and your feeds at the bottom, should be pretty easy to figure out.
Also the RSS feed does tend to spam a little as i've not finished it
so if you don't like spam it might require some fine tuning
If you decide to use this code give credit where it's due
Enjoy.
#!/usr/bin/perl
#__ ___ _____ _ _
#\ \ / (_) / ___| | (_)
# \ V / _ ______\ `--.| |__ _
# / \| |______|`--. \ '_ \| |
#/ /^\ \ | /\__/ / | | | |
#\/ \/_| \____/|_| |_|_|BOT[RSS Version] Created By Emery
[/font]
[font="Lucida Console"]use IO::Socket::INET ;
use LWP::UserAgent;
use LWP::Simple;
use XML::Simple;[/font]
[font="Lucida Console"]##Bot Configuration
my $server = "irc.server.com";
my $port = "6667";
my $nick ="RSS";
my $name = "rss user bawt perl";
my $channel = "#rss";[/font]
[font="Lucida Console"]system('cls');
print "\n [+] Connection To $server ....\n";[/font]
[font="Lucida Console"]##Server Connection
$connection = IO::Socket::INET->new(PeerAddr=>"$server",
PeerPort=>"$port",
Proto=>'tcp',
Timeout=>'30') or print " [!] Couldnt Connect To $server\n";
print " [+] Connected To $server ....\n\n";[/font]
[font="Lucida Console"]##Authentication
print $connection "USER $name\n";
print $connection "NICK $nick\r\n";[/font]
[font="Lucida Console"]##Commands
while($response = <$connection>)
{
##IRC Screen
print $response;
##Join Channel
if($response =~ m/<img src='http://www.governmentsecurity.org/forum/public/style_emoticons/<#EMO_DIR#>/sad.gif' class='bbc_emoticon' alt=':(' />.*) 00(.*) (.*) :/)
{
print $connection "JOIN $channel\r\n";
}
##Bot commands
if($response =~ m/:!Feeds/)
{
print $connection "PRIVMSG $channel : ----------------== RSS Feeds ==---------------\r\n";
print $connection "PRIVMSG $channel : BBC RSS Feed => : !bbc-tech \r\n";
print $connection "PRIVMSG $channel : Some RSS Feed => : !rss \r\n";
}
#-------------------- RSS FEEDS ------------------
##BBC Tech News
if ($response =~m/:!bbc-tech/)
{
my $rss = get('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml');
my $xml = XMLin($rss);
my $spl = scalar(@{$xml->{channel}->{item}});
for ($i=0; $i<$spl; $i++)
{
print $connection "PRIVMSG $channel :\n";
print $connection "PRIVMSG $channel :Date : $xml->{channel}->{item}->[$i]->{pubDate}\n";
print $connection "PRIVMSG $channel :Title: $xml->{channel}->{item}->[$i]->{title}\n";
print $connection "PRIVMSG $channel :Link : $xml->{channel}->{item}->[$i]->{link}\n\n";
};
}
[/font]
[font="Lucida Console"]












