Skip to content

Commit

Permalink
Improve device detection for unidentified SmartTV vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 12, 2024
1 parent 9cdf560 commit 13d069f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]], [

///////////////////
Expand Down
27 changes: 27 additions & 0 deletions test/data/ua/device/_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 13d069f

Please sign in to comment.