mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
GoogleSearch: fix versus mode and utf8 titles
This commit is contained in:
parent
cd776e7c84
commit
8896f4f1bb
@ -9,6 +9,8 @@ package Plugins::GoogleSearch;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
use feature 'unicode_strings';
|
||||||
|
|
||||||
use WWW::Google::CustomSearch;
|
use WWW::Google::CustomSearch;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
|
|
||||||
@ -80,7 +82,13 @@ sub googlesearch {
|
|||||||
return "$nick: No results for $b";
|
return "$nick: No results for $b";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$nick: $a: (", $result1->formattedTotalResults, ") ", decode_entities $result1->items->[0]->title, " <", $result1->items->[0]->link, "> VS $b: (", $result2->formattedTotalResults, ") ", decode_entities $result2->items->[0]->title, " <", $result2->items->[0]->link, ">";
|
my $title1 = $result1->items->[0]->title;
|
||||||
|
my $title2 = $result2->items->[0]->title;
|
||||||
|
|
||||||
|
utf8::decode $title1;
|
||||||
|
utf8::decode $title2;
|
||||||
|
|
||||||
|
return "$nick: $a: (" . $result1->formattedTotalResults . ") " . decode_entities($title1) . " <" . $result1->items->[0]->link . "> VS $b: (" . $result2->formattedTotalResults . ") " . decode_entities($title2) . " <" . $result2->items->[0]->link . ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $result = $engine->search($arguments);
|
my $result = $engine->search($arguments);
|
||||||
@ -93,7 +101,9 @@ sub googlesearch {
|
|||||||
|
|
||||||
my $comma = "";
|
my $comma = "";
|
||||||
foreach my $item (@{$result->items}) {
|
foreach my $item (@{$result->items}) {
|
||||||
$output .= $comma . decode_entities $item->title . ': <' . $item->link . ">";
|
my $title = $item->title;
|
||||||
|
utf8::decode $title;
|
||||||
|
$output .= $comma . decode_entities($title) . ': <' . $item->link . ">";
|
||||||
$comma = " -- ";
|
$comma = " -- ";
|
||||||
last if --$matches <= 0;
|
last if --$matches <= 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user