3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-25 04:02:37 +01:00

Dump LWP error text if get_title.pl fails to fetch webpage

This commit is contained in:
Pragmatic Software 2014-08-31 20:26:24 +00:00
parent 838f232d68
commit fa2e3e4b5d
2 changed files with 28 additions and 24 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 781, BUILD_REVISION => 782,
BUILD_DATE => "2014-08-31", BUILD_DATE => "2014-08-31",
}; };

View File

@ -15,29 +15,31 @@ if ($#ARGV <= 0)
my $nick = shift(@ARGV); my $nick = shift(@ARGV);
$arguments = join("%20", @ARGV); $arguments = join("%20", @ARGV);
exit if($arguments =~ m/stackoverflow.com/i); exit if $arguments =~ m/explosm.net/i;
exit if($arguments =~ m/scratch.mit.edu/i); exit if $arguments =~ m/stackoverflow.com/i;
exit if($arguments =~ m/imgur.com/i); exit if $arguments =~ m/scratch.mit.edu/i;
exit if($arguments =~ m/sprunge.us/i); exit if $arguments =~ m/c-faq.com/i;
exit if($arguments =~ m/pastebin.ws/i); exit if $arguments =~ m/imgur.com/i;
exit if($arguments =~ m/hastebin.com/i); exit if $arguments =~ m/sprunge.us/i;
exit if($arguments =~ m/lmgtfy.com/i); exit if $arguments =~ m/pastebin.ws/i;
exit if($arguments =~ m/gyazo/i); exit if $arguments =~ m/hastebin.com/i;
exit if($arguments =~ m/imagebin/i); exit if $arguments =~ m/lmgtfy.com/i;
exit if($arguments =~ m/\/wiki\//i); exit if $arguments =~ m/gyazo/i;
exit if($arguments =~ m/github.com/i); exit if $arguments =~ m/imagebin/i;
exit if($arguments =~ m/wiki.osdev.org/i); exit if $arguments =~ m/\/wiki\//i;
exit if($arguments =~ m/wikipedia.org/i); exit if $arguments =~ m/github.com/i;
exit if($arguments =~ m/everfall.com/i); exit if $arguments =~ m/wiki.osdev.org/i;
exit if($arguments =~ m/fukung.net/i); exit if $arguments =~ m/wikipedia.org/i;
exit if($arguments =~ m/\/paste\//i); exit if $arguments =~ m/everfall.com/i;
exit if($arguments =~ m/paste\./i); exit if $arguments =~ m/fukung.net/i;
exit if($arguments =~ m/pastie/i); exit if $arguments =~ m/\/paste\//i;
exit if($arguments =~ m/ideone.com/i); exit if $arguments =~ m/paste\./i;
exit if($arguments =~ m/codepad.org/i); exit if $arguments =~ m/pastie/i;
exit if($arguments =~ m/^http\:\/\/past(e|ing)\./i); exit if $arguments =~ m/ideone.com/i;
exit if($arguments =~ m/paste.*\.(?:com|org|net|ch|ca|de|uk|info)/i); exit if $arguments =~ m/codepad.org/i;
exit if($arguments =~ m/pasting.*\.(?:com|org|net|ca|de|uk|info|ch)/i); exit if $arguments =~ m/^http\:\/\/past(e|ing)\./i;
exit if $arguments =~ m/paste.*\.(?:com|org|net|ch|ca|de|uk|info)/i;
exit if $arguments =~ m/pasting.*\.(?:com|org|net|ca|de|uk|info|ch)/i;
my $ua = LWP::UserAgent->new; my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0"); $ua->agent("Mozilla/5.0");
@ -48,6 +50,8 @@ my $response = $ua->get("$arguments");
if (not $response->is_success) if (not $response->is_success)
{ {
#print "Couldn't get link.\n"; #print "Couldn't get link.\n";
use Data::Dumper;
print STDERR Dumper $response;
die "Couldn't get link: $arguments"; die "Couldn't get link: $arguments";
} }