mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-05 19:49:32 +01:00
Plugin/UrlTitles: update user-agents
This commit is contained in:
parent
1abc466e7a
commit
23efee674a
@ -18,8 +18,7 @@ use JSON::XS;
|
||||
|
||||
use constant {
|
||||
TIMEOUT => 30,
|
||||
USER_AGENT => 'Mozilla/5.0 (compatible)',
|
||||
MAX_SIZE => 1024 * 200,
|
||||
MAX_SIZE => 1024 * 800,
|
||||
};
|
||||
|
||||
sub initialize {
|
||||
@ -148,7 +147,15 @@ sub get_title {
|
||||
|
||||
my $ua = LWP::UserAgent::Paranoid->new(request_timeout => TIMEOUT);
|
||||
|
||||
$ua->agent(USER_AGENT);
|
||||
my $user_agent;
|
||||
|
||||
if ($url =~ /twitter.com/) {
|
||||
$user_agent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +https://www.google.com/bot.html)',
|
||||
} else {
|
||||
$user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0';
|
||||
}
|
||||
|
||||
$ua->agent($user_agent);
|
||||
$ua->max_size(MAX_SIZE);
|
||||
|
||||
my $response = $ua->get($url);
|
||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4514,
|
||||
BUILD_REVISION => 4515,
|
||||
BUILD_DATE => "2022-03-17",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user