From 13d069f1c46ffb7edfeaa32d1e55b361350e9ed2 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 12 Dec 2024 22:12:43 +0700 Subject: [PATCH] Improve device detection for unidentified SmartTV vendors --- src/main/ua-parser.js | 5 ++++- test/data/ua/device/_others.json | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/ua-parser.js b/src/main/ua-parser.js index 5981dea8..494dcbeb 100755 --- a/src/main/ua-parser.js +++ b/src/main/ua-parser.js @@ -784,7 +784,10 @@ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [ - /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors + // SmartTV from Unidentified Vendors + /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i + ], [MODEL, [TYPE, SMARTTV]], [ + /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i ], [[TYPE, SMARTTV]], [ /////////////////// diff --git a/test/data/ua/device/_others.json b/test/data/ua/device/_others.json index b830065a..b2bb7f19 100644 --- a/test/data/ua/device/_others.json +++ b/test/data/ua/device/_others.json @@ -34,6 +34,33 @@ "type": "mobile" } }, + { + "desc": "ChangHong Android TV", + "ua": "Mozilla/5.0 (Linux; U; Android 5.1.1; zh-cn; ChangHong Android TV Build/LMY49J) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/10.8 Mobile Safari/537.36", + "expect": { + "vendor": "undefined", + "model": "ChangHong", + "type": "smarttv" + } + }, + { + "desc": "MStar Android TV", + "ua": "Mozilla/5.0 (Linux; Android 4.3.1; MStar Android TV Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.95 Safari/537.36", + "expect": { + "vendor": "undefined", + "model": "MStar", + "type": "smarttv" + } + }, + { + "desc": "ONIDA Android TV", + "ua": "Mozilla/5.0 (Linux; Android 6.0; ONIDA Android TV Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2542.0 Mobile Safari/537.36", + "expect": { + "vendor": "undefined", + "model": "ONIDA", + "type": "smarttv" + } + }, { "desc": "JVC LT-43V55LFA Smart TV", "ua": "Mozilla/5.0 (Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 OPR/40.0.2207.0 OMI/4.9.0.237.DOM3-OPT.245 Model/Vestel-MB211 VSTVB MB200 HbbTV/1.2.1 (; JVC; MB211; 3.19.4.2; _TV_NT72563_2017 SmartTvA/3.0.0",