Add new device vendor: Roku

Source: https://github.com/WhichBrowser/Parser-PHP/blob/master/tests/data/television/roku.yaml
This commit is contained in:
Faisal Salman 2021-04-12 15:16:28 +07:00
parent 3792900410
commit 9bed2b1437
3 changed files with 33 additions and 3 deletions

View File

@ -64,7 +64,7 @@ console, mobile, tablet, smarttv, wearable, embedded
Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
Essential, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG,
Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
Palm, Panasonic, Pebble, Polytron, Realme, RIM, Samsung, Sharp, Siemens,
Palm, Panasonic, Pebble, Polytron, Realme, RIM, Roku, Samsung, Sharp, Siemens,
Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
# 'device.model' determined dynamically

View File

@ -90,8 +90,10 @@
return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g, EMPTY).split('.')[0] : undefined;
},
trim = function (str, len) {
str = str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, EMPTY);
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
if (typeof(str) === STR_TYPE) {
str = str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, EMPTY);
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
}
};
///////////////
@ -623,6 +625,7 @@
], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
/\(dtv[\);].+(aquos)/i // Sharp
], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices
], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
/\b(android tv|smart[-\s]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors

View File

@ -846,6 +846,33 @@
"type": "smarttv"
}
},
{
"desc": "Roku",
"ua": "Mozilla/5.0 (Roku) AppleWebKit/537.36 (KHTML, like Gecko) Web/1.1 Safari/537.36",
"expect": {
"vendor": "Roku",
"model": "",
"type": "smarttv"
}
},
{
"desc": "Roku",
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36 Roku/DVP-8.10 (468.10E04145A)",
"expect": {
"vendor": "Roku",
"model": "DVP-8.10",
"type": "smarttv"
}
},
{
"desc": "Roku",
"ua": "Roku4640X/DVP-7.70 (297.70E04154A)",
"expect": {
"vendor": "Roku",
"model": "DVP-7.70",
"type": "smarttv"
}
},
{
"desc": "Kindle Fire HD",
"ua": "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true",