User:Monie089

Monie 

A very awesome, cool, and helpful person on the Wii-Battle (http://wii-battle.com/) network. Please respect this person and great things shall happen to you. If you do not respect Monie, you shall die a painful death. - Frost

package torrentspy;

use LWP::Simple qw(get $ua); use strict; my $num_output = 5; $ua->timeout(7);

our %settings = ( trigger => '!tspy' );

sub main { my ( $plug, $chan, $nick, $host, $text ) = @_; if ($text eq 'null') { chucklebot->notice($nick, "$settings{'trigger'} requires a search term. Type !help $settings{'trigger'} for help."); } else { $text =~ s/\ /\+/g; my $content = get("http\:\/\/www\.torrentspy\.com\/rss.asp\?mode\=search\&query\=$text"); if (!$content) { chucklebot->notice($nick, "Unable to retrieve RSS. Timeout/Error."); return; } my @results = parse_content($content); if (@results > 1) { chucklebot->notice($nick, "$_") foreach (@results); }	 else { chucklebot->privmsg($chan, "No Results!?"); } undef($content); } }

sub parse_content { my $num_output = $num_output; my $content = shift; $content =~ s/\n//g; $content =~ s/\r//g; my ($title,$description,$link,@items,@results) = undef; if ($content =~ /\(.+?)\<\/title\>/i) { $title = $1; } if ($content =~ /\(.+?)\<\/description\>/i) { $description = $1; } if ($content =~ /\(.+?)\<\/link\>/i) { $link = $1; } $title = convert($title); $description = convert($description); $link = convert($link); if ($title) { push(@results, "�$title� - $description [$link]"); }	@items = split(/\(.+?)\<\/title\>/i) { $title = $1; } if (@items[$x] =~ /\(.+?)\<\/link\>/i) { $link = $1; } $title = convert($title); $link = convert($link); push(@results, "�$title� - $link"); } 	undef(@items); undef($content); return(@results); }

sub convert { my $line = shift; $line =~ s/\&lt\;//g; $line =~ s/\&amp\;/\&/g; $line =~ s/\&quot\;/\"/g;	#$line =~ s/ / /g;	return($line); } - From Your friend, Perl McScripter