Skip to content

Commit 3f645d8

Browse files
committed
Merge pull request tobie#286 from jpvincent/master
Add HbbTV devices
2 parents 92ab450 + e64e73a commit 3f645d8

File tree

4 files changed

+250
-1
lines changed

4 files changed

+250
-1
lines changed

regexes.yaml

+69-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
user_agent_parsers:
22
#### SPECIAL CASES TOP ####
33

4+
# HbbTV standard defines what features the browser should understand.
5+
# but it's like targeting "HTML5 browsers", effective browser support depends on the model
6+
# See os_parsers if you want to target a specific TV
7+
- regex: '(HbbTV)/(\d+)\.(\d+)\.(\d+) \('
8+
49
# must go before Firefox to catch SeaMonkey/Camino
510
- regex: '(SeaMonkey|Camino)/(\d+)\.(\d+)\.?([ab]?\d+[a-z]*)'
611

@@ -402,6 +407,63 @@ user_agent_parsers:
402407
family_replacement: 'Python Requests'
403408

404409
os_parsers:
410+
##########
411+
# HbbTV vendors
412+
##########
413+
414+
# starts with the easy one : Panasonic seems consistent across years, hope it will continue
415+
#HbbTV/1.1.1 (;Panasonic;VIERA 2011;f.532;0071-0802 2000-0000;)
416+
#HbbTV/1.1.1 (;Panasonic;VIERA 2012;1.261;0071-3103 2000-0000;)
417+
#HbbTV/1.2.1 (;Panasonic;VIERA 2013;3.672;4101-0003 0002-0000;)
418+
#- regex: 'HbbTV/\d+\.\d+\.\d+ \(;(Panasonic);VIERA ([0-9]{4});'
419+
420+
# Sony is consistent too but do not place year like the other
421+
# Opera/9.80 (Linux armv7l; HbbTV/1.1.1 (; Sony; KDL32W650A; PKG3.211EUA; 2013;); ) Presto/2.12.362 Version/12.11
422+
# Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Sony; KDL40HX751; PKG1.902EUA; 2012;);; en) Presto/2.10.250 Version/11.60
423+
# Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Sony; KDL22EX320; PKG4.017EUA; 2011;);; en) Presto/2.7.61 Version/11.00
424+
#- regex: 'HbbTV/\d+\.\d+\.\d+ \(; (Sony);.*;.*; ([0-9]{4});\)'
425+
426+
427+
# LG is consistent too, but we need to add manually the year model
428+
#Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/537.1+ (KHTML, like Gecko) Safari/537.1+ HbbTV/1.1.1 ( ;LGE ;NetCast 4.0 ;03.20.30 ;1.0M ;)
429+
#Mozilla/5.0 (DirectFB; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ HbbTV/1.1.1 ( ;LGE ;NetCast 3.0 ;1.0 ;1.0M ;)
430+
- regex: 'HbbTV/\d+\.\d+\.\d+ \( ;(LG)E ;NetCast 4.0'
431+
os_v1_replacement: '2013'
432+
- regex: 'HbbTV/\d+\.\d+\.\d+ \( ;(LG)E ;NetCast 3.0'
433+
os_v1_replacement: '2012'
434+
435+
# Samsung is on its way of normalizing their user-agent
436+
# HbbTV/1.1.1 (;Samsung;SmartTV2013;T-FXPDEUC-1102.2;;) WebKit
437+
# HbbTV/1.1.1 (;Samsung;SmartTV2013;T-MST12DEUC-1102.1;;) WebKit
438+
# HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit
439+
# HbbTV/1.1.1 (;;;;;) Maple_2011
440+
- regex: 'HbbTV/1.1.1 \(;;;;;\) Maple_2011'
441+
os_replacement: 'Samsung'
442+
os_v1_replacement: '2011'
443+
# manage the two models of 2013
444+
- regex: 'HbbTV/\d+\.\d+\.\d+ \(;(Samsung);SmartTV([0-9]{4});.*FXPDEUC'
445+
os_v2_replacement: 'UE40F7000'
446+
- regex: 'HbbTV/\d+\.\d+\.\d+ \(;(Samsung);SmartTV([0-9]{4});.*MST12DEUC'
447+
os_v2_replacement: 'UE32F4500'
448+
# generic Samsung (works starting in 2012)
449+
#- regex: 'HbbTV/\d+\.\d+\.\d+ \(;(Samsung);SmartTV([0-9]{4});'
450+
451+
# Philips : not found any other way than a manual mapping
452+
# Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Philips; ; ; ; ) CE-HTML/1.0 NETTV/4.1.3 PHILIPSTV/1.1.1; en) Presto/2.10.250 Version/11.60
453+
# Opera/9.80 (Linux mips ; U; HbbTV/1.1.1 (; Philips; ; ; ; ) CE-HTML/1.0 NETTV/3.2.1; en) Presto/2.6.33 Version/10.70
454+
- regex: 'HbbTV/1.1.1 \(; (Philips);.*NETTV/4'
455+
os_v1_replacement: '2013'
456+
- regex: 'HbbTV/1.1.1 \(; (Philips);.*NETTV/3'
457+
os_v1_replacement: '2012'
458+
- regex: 'HbbTV/1.1.1 \(; (Philips);.*NETTV/2'
459+
os_v1_replacement: '2011'
460+
461+
# the HbbTV emulator developers use HbbTV/1.1.1 (;;;;;) firetv-firefox-plugin 1.1.20
462+
- regex: 'HbbTV/\d+\.\d+\.\d+.*(firetv)-firefox-plugin (\d+).(\d+).(\d+)'
463+
os_replacement: 'FireHbbTV'
464+
465+
# generic HbbTV, hoping to catch manufacturer name (always after 2nd comma) and the first string that looks like a 2011-2019 year
466+
- regex: 'HbbTV/\d+\.\d+\.\d+ \(.*; ?([a-zA-Z]+) ?;.*(201[1-9]).*\)'
405467

406468
##########
407469
# Android
@@ -443,7 +505,7 @@ os_parsers:
443505
# lots of ua strings have Windows NT 4.1 !?!?!?!? !?!? !? !????!?! !!! ??? !?!?! ?
444506
# (very) roughly ordered in terms of frequency of occurence of regex (win xp currently most frequent, etc)
445507
##########
446-
508+
447509
- regex: '(Windows (?:NT 5\.2|NT 5\.1))'
448510
os_replacement: 'Windows XP'
449511

@@ -891,6 +953,12 @@ device_parsers:
891953
- regex: 'Lenovo_([A-Za-z0-9]+)'
892954
device_replacement: 'Lenovo $1'
893955

956+
##########
957+
# HbbTV (European and Australian standard)
958+
# written before the LG regexes, as LG is making HbbTV too
959+
##########
960+
- regex: '(HbbTV)/[0-9]+\.[0-9]+\.[0-9]+'
961+
894962
##########
895963
# lg
896964
##########

test_resources/test_device.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,59 @@ test_cases:
255255
- user_agent_string: 'Mozilla/5.0 (Linux; U; Android 4.1.2; en-; GT-N7000 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
256256
family: 'GT-N7000'
257257

258+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2012;1.261;0071-3103 2000-0000;)'
259+
family: 'HbbTV'
258260

261+
- user_agent_string: 'Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/537.1+ (KHTML, like Gecko) Safari/537.1+ HbbTV/1.1.1 ( ;LGE ;NetCast 4.0 ;03.20.30 ;1.0M ;)'
262+
family: 'HbbTV'
263+
264+
- user_agent_string: 'Mozilla/5.0 (DirectFB; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ HbbTV/1.1.1 ( ;LGE ;NetCast 3.0 ;1.0 ;1.0M ;)'
265+
family: 'HbbTV'
266+
267+
- user_agent_string: 'Opera/9.80 (Linux armv7l; HbbTV/1.1.1 (; Sony; KDL32W650A; PKG3.211EUA; 2013;); ) Presto/2.12.362 Version/12.11'
268+
family: 'HbbTV'
269+
270+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2012;1.261;0071-3103 2000-0000;)'
271+
family: 'HbbTV'
272+
273+
- user_agent_string: 'Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/537.1+ (KHTML, like Gecko) Safari/537.1+ HbbTV/1.1.1 ( ;LGE ;NetCast 4.0 ;03.20.30 ;1.0M ;)'
274+
family: 'HbbTV'
275+
276+
- user_agent_string: 'Mozilla/5.0 (DirectFB; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ HbbTV/1.1.1 ( ;LGE ;NetCast 3.0 ;1.0 ;1.0M ;)'
277+
family: 'HbbTV'
278+
279+
- user_agent_string: 'Opera/9.80 (Linux armv7l; HbbTV/1.1.1 (; Sony; KDL32W650A; PKG3.211EUA; 2013;); ) Presto/2.12.362 Version/12.11'
280+
family: 'HbbTV'
281+
282+
# up market model
283+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2013;T-FXPDEUC-1102.2;;) WebKit'
284+
family: 'HbbTV'
285+
286+
# mid-range model
287+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2013;T-MST12DEUC-1102.1;;) WebKit'
288+
family: 'HbbTV'
289+
290+
- user_agent_string: 'HbbTV/1.2.1 (;Panasonic;VIERA 2013;3.672;4101-0003 0002-0000;)'
291+
family: 'HbbTV'
292+
293+
# no way to differentiate models
294+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit'
295+
family: 'HbbTV'
296+
297+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2012;1.261;0071-3103 2000-0000;)'
298+
family: 'HbbTV'
299+
300+
- user_agent_string: 'Opera/9.80 (Linux mips ; U; HbbTV/1.1.1 (; Philips; ; ; ; ) CE-HTML/1.0 NETTV/3.2.1; en) Presto/2.6.33 Version/10.70'
301+
family: 'HbbTV'
302+
303+
- user_agent_string: 'HbbTV/1.1.1 (;;;;;) Maple_2011'
304+
family: 'HbbTV'
305+
306+
- user_agent_string: 'Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Sony; KDL22EX320; PKG4.017EUA; 2011;);; en) Presto/2.7.61 Version/11.00'
307+
family: 'HbbTV'
308+
309+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2011;f.532;0071-0802 2000-0000;)'
310+
family: 'HbbTV'
311+
312+
- user_agent_string: 'HbbTV/1.1.1 (;;;;;) firetv-firefox-plugin 1.1.20'
313+
family: 'HbbTV'

test_resources/test_user_agent_parser.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -867,3 +867,21 @@ test_cases:
867867
major: '11'
868868
minor: '0'
869869
patch:
870+
871+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2013;T-FXPDEUC-1102.2;;) WebKit'
872+
family: 'HbbTV'
873+
major: '1'
874+
minor: '1'
875+
patch: '1'
876+
877+
- user_agent_string: 'HbbTV/1.2.1 (;Panasonic;VIERA 2013;3.672;4101-0003 0002-0000;)'
878+
family: 'HbbTV'
879+
major: '1'
880+
minor: '2'
881+
patch: '1'
882+
883+
- user_agent_string: 'HbbTV/1.1.1 (;;;;;) firetv-firefox-plugin 1.1.20'
884+
family: 'HbbTV'
885+
major: '1'
886+
minor: '1'
887+
patch: '1'

test_resources/test_user_agent_parser_os.yaml

+108
Original file line numberDiff line numberDiff line change
@@ -864,3 +864,111 @@ test_cases:
864864
minor:
865865
patch:
866866
patch_minor:
867+
868+
- user_agent_string: 'Mozilla/5.0 (Unknown; Linux armv7l) AppleWebKit/537.1+ (KHTML, like Gecko) Safari/537.1+ HbbTV/1.1.1 ( ;LGE ;NetCast 4.0 ;03.20.30 ;1.0M ;)'
869+
family: 'LG'
870+
major: '2013'
871+
minor:
872+
patch:
873+
patch_minor:
874+
875+
- user_agent_string: 'Mozilla/5.0 (DirectFB; Linux armv7l) AppleWebKit/534.26+ (KHTML, like Gecko) Version/5.0 Safari/534.26+ HbbTV/1.1.1 ( ;LGE ;NetCast 3.0 ;1.0 ;1.0M ;)'
876+
family: 'LG'
877+
major: '2012'
878+
minor:
879+
patch:
880+
patch_minor:
881+
882+
- user_agent_string: 'Opera/9.80 (Linux armv7l; HbbTV/1.1.1 (; Sony; KDL32W650A; PKG3.211EUA; 2013;); ) Presto/2.12.362 Version/12.11'
883+
family: 'Sony'
884+
major: '2013'
885+
minor:
886+
patch:
887+
patch_minor:
888+
889+
- user_agent_string: 'Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Sony; KDL40HX751; PKG1.902EUA; 2012;);; en) Presto/2.10.250 Version/11.60'
890+
family: 'Sony'
891+
major: '2012'
892+
minor:
893+
patch:
894+
patch_minor:
895+
896+
- user_agent_string: 'Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Sony; KDL22EX320; PKG4.017EUA; 2011;);; en) Presto/2.7.61 Version/11.00'
897+
family: 'Sony'
898+
major: '2011'
899+
minor:
900+
patch:
901+
patch_minor:
902+
903+
# up market model
904+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2013;T-FXPDEUC-1102.2;;) WebKit'
905+
family: 'Samsung'
906+
major: '2013'
907+
minor: 'UE40F7000'
908+
patch:
909+
patch_minor:
910+
911+
# mid-range model
912+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2013;T-MST12DEUC-1102.1;;) WebKit'
913+
family: 'Samsung'
914+
major: '2013'
915+
minor: 'UE32F4500'
916+
patch:
917+
patch_minor:
918+
919+
# no way to differentiate models
920+
- user_agent_string: 'HbbTV/1.1.1 (;Samsung;SmartTV2012;;;) WebKit'
921+
family: 'Samsung'
922+
major: '2012'
923+
minor:
924+
patch:
925+
patch_minor:
926+
927+
- user_agent_string: 'HbbTV/1.1.1 (;;;;;) Maple_2011'
928+
family: 'Samsung'
929+
major: '2011'
930+
minor:
931+
patch:
932+
patch_minor:
933+
934+
- user_agent_string: 'Opera/9.80 (Linux mips ; U; HbbTV/1.1.1 (; Philips; ; ; ; ) CE-HTML/1.0 NETTV/3.2.1; en) Presto/2.6.33 Version/10.70'
935+
family: 'Philips'
936+
major: '2012'
937+
minor:
938+
patch:
939+
patch_minor:
940+
941+
- user_agent_string: 'Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Philips; ; ; ; ) CE-HTML/1.0 NETTV/4.1.3 PHILIPSTV/1.1.1; en) Presto/2.10.250 Version/11.60'
942+
family: 'Philips'
943+
major: '2013'
944+
minor:
945+
patch:
946+
patch_minor:
947+
948+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2011;f.532;0071-0802 2000-0000;)'
949+
family: 'Panasonic'
950+
major: '2011'
951+
minor:
952+
patch:
953+
patch_minor:
954+
955+
- user_agent_string: 'HbbTV/1.1.1 (;Panasonic;VIERA 2012;1.261;0071-3103 2000-0000;)'
956+
family: 'Panasonic'
957+
major: '2012'
958+
minor:
959+
patch:
960+
patch_minor:
961+
962+
- user_agent_string: 'HbbTV/1.2.1 (;Panasonic;VIERA 2013;3.672;4101-0003 0002-0000;)'
963+
family: 'Panasonic'
964+
major: '2013'
965+
minor:
966+
patch:
967+
patch_minor:
968+
969+
- user_agent_string: 'HbbTV/1.1.1 (;;;;;) firetv-firefox-plugin 1.1.20'
970+
family: 'FireHbbTV'
971+
major: '1'
972+
minor: '1'
973+
patch: '20'
974+
patch_minor:

0 commit comments

Comments
 (0)