Skip to content

Commit

Permalink
v1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zonuexe committed Sep 25, 2021
1 parent b24971e commit 04211b8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/AgentCategory/Browser/SamsungBrowser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Woothee\AgentCategory\Browser;

use Woothee\AgentCategory\AbstractCategory;
use Woothee\DataSet;

class SamsungBrowser extends AbstractCategory
{
public static function challenge($ua, &$result)
{
if (strpos($ua, 'SamsungBrowser/') === false) {
return false;
}

$version = DataSet::VALUE_UNKNOWN;

if (preg_match('/SamsungBrowser\/([.0-9]+)/Du', $ua, $matches)) {
$version = $matches[1];
}

static::updateMap($result, DataSet::get('SamsungBrowser'));
static::updateVersion($result, $version);

return true;
}
}
12 changes: 12 additions & 0 deletions src/AgentCategory/Crawler/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ public static function challenge($ua, &$result)
}
}

if (strpos($ua, 'compatible; AdsBot-Google-Mobile;') !== false) {
static::updateMap($result, DataSet::get('AdsBotGoogleMobile'));

return true;
}

if (strpos($ua, 'AdsBot-Google') === 0) {
static::updateMap($result, DataSet::get('AdsBotGoogle'));

return true;
}

if (strpos($ua, 'Googlebot-Image/') !== false) {
static::updateMap($result, DataSet::get('GoogleBot'));

Expand Down
5 changes: 5 additions & 0 deletions src/Classifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Woothee\AgentCategory\Browser\Msie;
use Woothee\AgentCategory\Browser\Opera;
use Woothee\AgentCategory\Browser\SafariChrome;
use Woothee\AgentCategory\Browser\SamsungBrowser;
use Woothee\AgentCategory\Browser\Sleipnir;
use Woothee\AgentCategory\Browser\Vivaldi;
use Woothee\AgentCategory\Browser\Webview;
Expand Down Expand Up @@ -76,6 +77,10 @@ public function tryBrowser($ua, &$result)
return true;
}

if (SamsungBrowser::challenge($ua, $result)) {
return true;
}

if (SafariChrome::challenge($ua, $result)) {
return true;
}
Expand Down
20 changes: 19 additions & 1 deletion src/DataSet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Woothee;

// GENERATED from dataset.yml at Mon Sep 20 17:44:29 UTC 2021 by tadsan
// GENERATED from dataset.yml at Sat Sep 25 04:34:00 UTC 2021 by tadsan
class DataSet
{
const DATASET_KEY_LABEL = 'label';
Expand Down Expand Up @@ -118,6 +118,12 @@ class DataSet
'type' => 'browser',
'vendor' => 'Yandex',
),
'SamsungBrowser' => array(
'label' => 'SamsungBrowser',
'name' => 'SamsungBrowser',
'type' => 'browser',
'vendor' => 'Samsung',
),
'Win' => array(
'label' => 'Win',
'name' => 'Windows UNKNOWN Ver',
Expand Down Expand Up @@ -639,6 +645,18 @@ class DataSet
'name' => 'misc crawler',
'type' => 'full',
'category' => 'crawler',
),
'AdsBotGoogleMobile' => array(
'label' => 'AdsBotGoogleMobile',
'name' => 'AdsBot-Google-Mobile',
'type' => 'full',
'category' => 'crawler',
),
'AdsBotGoogle' => array(
'label' => 'AdsBotGoogle',
'name' => 'AdsBot-Google',
'type' => 'full',
'category' => 'crawler',
)
);

Expand Down

0 comments on commit 04211b8

Please sign in to comment.