use Irssi; use LWP::UserAgent; use strict; use vars qw($VERSION %IRSSI $cache); $VERSION = '1.03'; %IRSSI = ( authors => 'Eric Jansen', contact => 'chaos@sorcery.net', name => 'imdb', description => 'Automatically lookup IMDB-numbers in nicknames', commands => '', license => 'GPL', modules => 'LWP::UserAgent', changed => 'Thu Oct 2 21:19:56 CEST 2003' ); my $ua = new LWP::UserAgent; $ua->agent('Irssi; ' . $ua->agent); $ua->timeout(2); sub event_nickchange { my ($channel, $nick, $old_nick) = @_; if($nick->{'nick'} ne $channel->{'ownnick'}->{'nick'} && $nick->{'nick'} =~ /\D(\d{7})(?:\D|$)/) { my $id = $1; if(defined $cache->{$id}) { if(defined $cache->{$id}->{'rating'}) { $channel->printformat(MSGLEVEL_CRAP, 'imdb_rating', $old_nick, $cache->{$id}->{'title'}, $cache->{$id}->{'year'}, $cache->{$id}->{'rating'}, $cache->{$id}->{'votes'}); } else { $channel->printformat(MSGLEVEL_CRAP, 'imdb', $old_nick, $cache->{$id}->{'title'}, $cache->{$id}->{'year'}); } } else { my $req = new HTTP::Request(GET => "http://www.imdb.com/title/tt$id/"); my $res = $ua->request($req); if($res->is_success && $res->content =~ /