Skip to content

Commit

Permalink
add amazonbot
Browse files Browse the repository at this point in the history
  • Loading branch information
mla authored and oalders committed Oct 2, 2024
1 parent 38b1ec6 commit 627cb96
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/HTTP/BrowserDetect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ our @ENGINE_TESTS = qw(
my @OLD_ROBOT_TESTS = qw(
ahrefs
altavista
amazonbot
apache
askjeeves
baidu
Expand Down Expand Up @@ -201,6 +202,7 @@ our @ROBOT_TESTS = (
[ 'vkShare', 'vkshare' ],
[ 'W3C_Validator', 'w3c-validator' ],
[ 'WhatsApp', 'whatsapp' ],
[ 'Amazonbot', 'amazonbot' ],
);

our @MISC_TESTS = qw(
Expand All @@ -225,6 +227,7 @@ our @ALL_TESTS = (
my %ROBOT_NAMES = (
ahrefs => 'Ahrefs',
altavista => 'AltaVista',
amazonbot => 'Amazonbot',
'apache-http-client' => 'Apache HttpClient',
apple => 'Apple',
'archive-org' => 'Internet Archive',
Expand Down Expand Up @@ -347,6 +350,7 @@ my %ROBOT_IDS = (
yandex => 'yandex',
yandeximages => 'yandex-images',
headlesschrome => 'headless-chrome',
amazonbot => 'amazonbot',
);

my %BROWSER_NAMES = (
Expand Down Expand Up @@ -3264,7 +3268,8 @@ googleadsbot, googleadsense, googlebotimage, googlebotnews,
googlebotvideo, googlefavicon, googlemobile, google, golib, indy,
infoseek, ipsagent, linkchecker, linkexchange, lycos, malware,
mj12bot, nutch, phplib, puf, rubylib, scooter, specialarchiver,
wget, yandexbot, yandeximages, java, headlesschrome, unknown
wget, yandexbot, yandeximages, java, headlesschrome, amazonbot,
unknown
Returns "unknown" when the user agent is believed to be a robot but
is not identified as one of the above specific robots.
Expand Down
2 changes: 1 addition & 1 deletion t/05_robot.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ my $detect = HTTP::BrowserDetect->new;
my %names = $detect->_robot_names;
my @ids = $detect->all_robot_ids;
my %fixup = $detect->_robot_ids;
is( scalar @ids, 75, 'correct number of ids' );
is( scalar @ids, 76, 'correct number of ids' );

foreach my $id (@ids) {
subtest $id => sub {
Expand Down
11 changes: 11 additions & 0 deletions t/more-useragents.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{
"(Amazonbot/0.1; +https://developer.amazon.com/support/amazonbot)" : {
"browser_major" : 0,
"browser_minor" : ".1",
"match" : [
"robot",
"amazonbot"
],
"robot" : "amazonbot",
"robot_name" : "Amazonbot",
"robot_version" : "0.1"
},
"AccServer[admin-HDNVR]/5.2.2.24(27991) 64-bit HTTP-Agent" : {
"browser_beta" : ".2.24(27991)",
"browser_major" : "5",
Expand Down

0 comments on commit 627cb96

Please sign in to comment.