Skip to content

Commit

Permalink
Adds detection for UC Browser Turbo browser (#6133)
Browse files Browse the repository at this point in the history
* Adds detection for UC Browser Turbo browser

* Add test

* Add test

* Update smartphone-6.yml

Co-authored-by: Stefan Giehl <[email protected]>
  • Loading branch information
liviuconcioiu and sgiehl committed Dec 21, 2019
1 parent 5040c45 commit 2315ff4
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class Browser extends ClientParserAbstract
'UB' => 'UBrowser',
'UC' => 'UC Browser',
'UM' => 'UC Browser Mini',
'UT' => 'UC Browser Turbo',
'UZ' => 'Uzbl',
'VI' => 'Vivaldi',
'VV' => 'vivo Browser',
Expand Down Expand Up @@ -286,7 +287,7 @@ class Browser extends ClientParserAbstract
* @var array
*/
protected static $mobileOnlyBrowsers = array(
'36', 'OC', 'PU', 'SK', 'MF', 'OI', 'OM', 'DD', 'DB', 'ST', 'BL', 'IV', 'FM', 'C1', 'AL', 'SA', 'SB', 'FR', 'WP', 'HA', 'NX', 'HU', 'VV', 'RE', 'CB', 'MZ', 'UM', 'FK', 'FX', 'WI', 'MN', 'M1', 'AH', 'SU', 'EU', 'EZ'
'36', 'OC', 'PU', 'SK', 'MF', 'OI', 'OM', 'DD', 'DB', 'ST', 'BL', 'IV', 'FM', 'C1', 'AL', 'SA', 'SB', 'FR', 'WP', 'HA', 'NX', 'HU', 'VV', 'RE', 'CB', 'MZ', 'UM', 'FK', 'FX', 'WI', 'MN', 'M1', 'AH', 'SU', 'EU', 'EZ', 'UT'
);

/**
Expand Down
9 changes: 9 additions & 0 deletions Tests/Parser/Client/fixtures/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,15 @@
engine: WebKit
engine_version: "537.36"
-
user_agent: Mozilla/5.0 (Linux; U; Android 7.0; BV6000 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.10.0.1163 UCTurbo/1.7.9.900 Mobile Safari/537.36
client:
type: browser
name: UC Browser Turbo
short_name: UT
version: "1.7.9.900"
engine: WebKit
engine_version: "537.36"
-
user_agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 UBrowser/5.5.5701.114 Safari/537.36
client:
type: browser
Expand Down
46 changes: 43 additions & 3 deletions Tests/fixtures/smartphone-6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1716,9 +1716,9 @@
platform: ""
client:
type: browser
name: UC Browser
short_name: UC
version: "12.10.0.1163"
name: UC Browser Turbo
short_name: UT
version: "1.4.9.900"
engine: WebKit
engine_version: "537.36"
device:
Expand Down Expand Up @@ -9921,3 +9921,43 @@
model: Lai Z
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; U; Android 7.0; BV6000 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.10.0.1163 UCTurbo/1.7.9.900 Mobile Safari/537.36
os:
name: Android
short_name: AND
version: "7.0"
platform: ""
client:
type: browser
name: UC Browser Turbo
short_name: UT
version: "1.7.9.900"
engine: WebKit
engine_version: "537.36"
device:
type: smartphone
brand: B2
model: BV6000
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; U; Android 5.0.2; SM-G530F Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 Mobile Safari/537.36 UCBrowser/12.10.0.1163 UCTurbo/1.4.2.893
os:
name: Android
short_name: AND
version: "5.0.2"
platform: ""
client:
type: browser
name: UC Browser Turbo
short_name: UT
version: "1.4.2.893"
engine: WebKit
engine_version: "537.36"
device:
type: phablet
brand: SA
model: GALAXY Grand Prime
os_family: Android
browser_family: Unknown
8 changes: 8 additions & 0 deletions regexes/client/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,14 @@
name: 'UC Browser Mini'
version: ''

# UC Browser Turbo
- regex: 'UCTurbo(?:[ /]?(\d+[\.\d]+))?'
name: 'UC Browser Turbo'
version: '$1'
- regex: 'UC[ ]?Browser.* \(UCTurbo\)'
name: 'UC Browser Turbo'
version: ''

#Opera
- regex: '(?:Opera Tablet.*Version|Opera/.+Opera Mobi.+Version|Mobile.+OPR)/(\d+[\.\d]+)'
name: 'Opera Mobile'
Expand Down

0 comments on commit 2315ff4

Please sign in to comment.