Plugin/UrlTitles: update user-agents

This commit is contained in:
Pragmatic Software 2022-03-17 19:17:31 -07:00
parent 1abc466e7a
commit 23efee674a
2 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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",
};