Skip to content

Commit

Permalink
Improves detection for various tv brands (#8004)
Browse files Browse the repository at this point in the history
* Improve isHbbTv regex
* Move regexes to televisions.yml
  • Loading branch information
liviuconcioiu authored Feb 24, 2025
1 parent 8c4b4fe commit 50da73a
Show file tree
Hide file tree
Showing 5 changed files with 492 additions and 155 deletions.
6 changes: 3 additions & 3 deletions Parser/Device/HbbTv.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class HbbTv extends AbstractDeviceParser
protected $parserName = 'tv';

/**
* Parses the current UA and checks whether it contains HbbTv information
* Parses the current UA and checks whether it contains HbbTv or SmartTvA information
*
* @see televisions.yml for list of detected televisions
*
* @return array|null
*/
public function parse(): ?array
{
// only parse user agents containing fragments: hbbtv
// only parse user agents containing fragments: hbbtv or SmartTvA
if (null === $this->isHbbTv()) {
return null;
}
Expand All @@ -58,7 +58,7 @@ public function parse(): ?array
*/
public function isHbbTv(): ?string
{
$regex = 'HbbTV/([1-9]{1}(?:\.[0-9]{1}){1,2})';
$regex = '(?:HbbTV|SmartTvA)/([1-9]{1}(?:\.[0-9]{1}){1,2})';
$match = $this->matchUserAgent($regex);

return $match[1] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion Tests/fixtures/tv-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@
device:
type: tv
brand: Philips
model: 43PUS8808
model: 43PUS8808/12
os_family: GNU/Linux
browser_family: Chrome
-
Expand Down
342 changes: 342 additions & 0 deletions Tests/fixtures/tv-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7554,6 +7554,348 @@
model: Bt 50FSU34B
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.105 Model/Vestel-MB180 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB180 CLAYTON) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: CLAYTON
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 CROWN) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Crown
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 DAEWOO) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Daewoo
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 DIORA) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: DIORA
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 EDENWOOD) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Edenwood
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.127 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 FU) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: 'F&U'
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 FUEGO) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Fuego
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 GOGEN) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: GoGEN
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.115 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 HI-LEVEL) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Hi-Level
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 HITACHI) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Hitachi
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.127 Model/Vestel-MB180 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB180 HORIZON) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Horizon
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.102 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 JVC) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: JVC
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 KENDO) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Kendo
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.127 Model/Vestel-MB180 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB180 KYDOS) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Kydos
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 LUXOR) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: Luxor
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 NEXON) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: NEXON
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB180 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB180 REGAL) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: REGAL
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.117 Model/Vestel-MB181 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB181 SEG) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: SEG
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Safari/537.36 OPR/46.0.2207.0 OMI/4.23.2.96.LIMA2.127 Model/Vestel-MB180 VSTVB MB100 TiVoOS/1.0.0 (Vestel MB180 VOX) SmartTvA/3.0.0
os:
name: TiVo OS
version: 1.0.0
platform: ""
client:
type: browser
name: Opera Devices
version: 4.23.2.96
engine: Blink
engine_version: 108.0.5359.128
device:
type: tv
brand: VOX
model: ""
os_family: GNU/Linux
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 OPR/46.0.2207.0 OMI/4.13.5.431.SIERRA.160 Model/Vestel-MB230 VSTVB MB200 HbbTV/1.5.1 (+DRM; ALDISUED; MB230; 0.51.43.0; ; _TV_NT72671_2019;) SmartTvA/3.0.0 CE-HTML/1.0 FXM-U2FsdGVkX1+oZew0140/QPzDVHFgksz6LOoQU4j7ORKm2mOWQeWL86jOKxCCVSvO-END
os:
Expand Down
Loading

0 comments on commit 50da73a

Please sign in to comment.