1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-09 12:25:40 -04:00

reverting to switch to new version.

Revert "my fucked up version.  time to revert, found new url."

This reverts commit b1081fe98b.
This commit is contained in:
Ryan Voots 2012-07-07 14:58:56 -04:00
parent b1081fe98b
commit d0e6c231ca

View file

@ -13,17 +13,16 @@ sub {
warn 1;
if( $q =~ /^\s*(?:(?:help|wtf|\?|\:)\s*)?$/i )
{
print "see http://oeis.org/";
print "see http://tinyurl.com/7xmvs and http://tinyurl.com/2blo2w";
return;
}
warn 2;
my $uri = "http://oeis.org/?fmt=data&q=" . CGI::escape($q);
my $uri = "http://www.research.att.com/~njas/sequences/?q=" . CGI::escape($q) . "&n=1&fmt=3";
local $_ = get($uri); # change this in the real plugin
warn 2.5;
if (/^Displaying .* of (\d+) results?/mi) {
if (/^Results .* of (\d+) results/mi) {
my $nrfound = $1;
# this is so fucked up
unless( m|<a href="[^"]+">(A\d+)</a>.*?align=left>(.*)<br>|si )
unless( /^%N (\S+) (.*)/m )
{
print "Reply from OEIS in unknown format 2";
return;
@ -35,19 +34,20 @@ sub {
$elts =~ s/,,+/,/g;
warn 3.5;
if (1 == $nrfound) {
my $outuri = sprintf "http://oeis.org/A%.10s", $anum;
my $outuri = sprintf "http://tinyurl.com/4zq4q/%.10s", $anum;
print sprintf "%s %.256s: %.512s", $outuri, $title, $elts;
} else {
my $outuri1 = "http://oeis.org/?q=" . CGI::escape($q);
my $outuri1 = "http://www.research.att.com/~njas/sequences/?q=" . CGI::escape($q);
warn 3.6;
print sprintf "%s %.10s(1/%d) %.256s: %.512s", $outuri1, $anum, $nrfound, $title, $elts;
my $outuri = makeashorterlink($outuri1) || $outuri1;
print sprintf "%s %.10s(1/%d) %.256s: %.512s", $outuri, $anum, $nrfound, $title, $elts;
}
} elsif (/^no matches/mi) {
print "No matches found";
warn 4
} else {
warn 5;
print "Reply from OEIS in unknown format: $_";
print "Reply from OEIS in unknown format";
}
}