diff --git a/lib/PBot/Plugin/UrlTitles.pm b/lib/PBot/Plugin/UrlTitles.pm index 56dbaf58..85905270 100644 --- a/lib/PBot/Plugin/UrlTitles.pm +++ b/lib/PBot/Plugin/UrlTitles.pm @@ -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); diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 9d05e5b0..38b1ea7b 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -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", };