user_agent_parser 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/user_agent_parser/parser.rb +30 -30
- data/vendor/uap-core/regexes.yaml +67 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48095209e88dd1c8b49954029334bddecbbb1facb44cbf3b2ed5e700b259541
|
4
|
+
data.tar.gz: 06b14639160f7cdc6f3b0cc0ffc88147cee9cd1b92dc8a10ad61a420edb4a5fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d1c6ad450918654bf5c6b9e9aaffd6ba3e28a01d17741a4443dc63110c30d310b81654de91297e9ce79ec31de3da40d8088d792cb100aca91d486b5410cf67
|
7
|
+
data.tar.gz: be73315646276e7ab2db8ce86cc54e5802fcd6cff84c8176c2af9db935911f853606edada097ac1ab471c5b9b4557363b27099412388599279790edf10882565
|
@@ -39,6 +39,36 @@ module UserAgentParser
|
|
39
39
|
parse_ua(user_agent, os, device)
|
40
40
|
end
|
41
41
|
|
42
|
+
def parse_os(user_agent)
|
43
|
+
pattern, match = first_pattern_match(@os_patterns, user_agent)
|
44
|
+
|
45
|
+
if match
|
46
|
+
os_from_pattern_match(pattern, match)
|
47
|
+
else
|
48
|
+
OperatingSystem.new
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def parse_device(user_agent)
|
53
|
+
pattern, match = first_pattern_match(@device_patterns, user_agent)
|
54
|
+
|
55
|
+
if match
|
56
|
+
device_from_pattern_match(pattern, match)
|
57
|
+
else
|
58
|
+
Device.new
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def parse_ua(user_agent, os = nil, device = nil)
|
63
|
+
pattern, match = first_pattern_match(@ua_patterns, user_agent)
|
64
|
+
|
65
|
+
if match
|
66
|
+
user_agent_from_pattern_match(pattern, match, os, device)
|
67
|
+
else
|
68
|
+
UserAgent.new(nil, nil, os, device)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
42
72
|
def patterns_path
|
43
73
|
patterns_paths.first
|
44
74
|
end
|
@@ -76,36 +106,6 @@ module UserAgentParser
|
|
76
106
|
end
|
77
107
|
end
|
78
108
|
|
79
|
-
def parse_ua(user_agent, os = nil, device = nil)
|
80
|
-
pattern, match = first_pattern_match(@ua_patterns, user_agent)
|
81
|
-
|
82
|
-
if match
|
83
|
-
user_agent_from_pattern_match(pattern, match, os, device)
|
84
|
-
else
|
85
|
-
UserAgent.new(nil, nil, os, device)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def parse_os(user_agent)
|
90
|
-
pattern, match = first_pattern_match(@os_patterns, user_agent)
|
91
|
-
|
92
|
-
if match
|
93
|
-
os_from_pattern_match(pattern, match)
|
94
|
-
else
|
95
|
-
OperatingSystem.new
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def parse_device(user_agent)
|
100
|
-
pattern, match = first_pattern_match(@device_patterns, user_agent)
|
101
|
-
|
102
|
-
if match
|
103
|
-
device_from_pattern_match(pattern, match)
|
104
|
-
else
|
105
|
-
Device.new
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
109
|
def first_pattern_match(patterns, value)
|
110
110
|
patterns.each do |pattern|
|
111
111
|
return [pattern, pattern[:regex].match(value)] if pattern[:regex].match?(value)
|
@@ -78,6 +78,9 @@ user_agent_parsers:
|
|
78
78
|
# 'Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PingdomTMS/0.8.5 Safari/534.34'
|
79
79
|
- regex: '(PingdomTMS)/(\d+)\.(\d+)\.(\d+)'
|
80
80
|
family_replacement: 'PingdomBot'
|
81
|
+
# 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/61.0.3163.100 Chrome/61.0.3163.100 Safari/537.36 PingdomPageSpeed/1.0 (pingbot/2.0; +http://www.pingdom.com/)'
|
82
|
+
- regex: '(PingdomPageSpeed)/(\d+)\.(\d+)'
|
83
|
+
family_replacement: 'PingdomBot'
|
81
84
|
|
82
85
|
# PTST / WebPageTest.org crawlers
|
83
86
|
- regex: ' (PTST)/(\d+)(?:\.(\d+)|)$'
|
@@ -217,11 +220,11 @@ user_agent_parsers:
|
|
217
220
|
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Phantom\/ios|android).(\d+)\.(\d+)\.(\d+)'
|
218
221
|
family_replacement: 'Phantom'
|
219
222
|
|
220
|
-
# aspiegel.com spider (owned by Huawei)
|
221
|
-
- regex: 'Mozilla.{1,100}Mobile.{1,100}AspiegelBot'
|
223
|
+
# aspiegel.com spider (owned by Huawei, later called PetalBot)
|
224
|
+
- regex: 'Mozilla.{1,100}Mobile.{1,100}(AspiegelBot|PetalBot)'
|
222
225
|
family_replacement: 'Spider'
|
223
226
|
|
224
|
-
- regex: 'AspiegelBot'
|
227
|
+
- regex: 'AspiegelBot|PetalBot'
|
225
228
|
family_replacement: 'Spider'
|
226
229
|
|
227
230
|
# Basilisk
|
@@ -388,6 +391,10 @@ user_agent_parsers:
|
|
388
391
|
- regex: '(EdgiOS|EdgA)/(\d+)\.(\d+)\.(\d+)(?:\.(\d+)|)'
|
389
392
|
family_replacement: 'Edge Mobile'
|
390
393
|
|
394
|
+
# Oculus Browser, should go before Samsung Internet
|
395
|
+
- regex: '(OculusBrowser)/(\d+)\.(\d+).0.0(?:\.([0-9\-]+)|)'
|
396
|
+
family_replacement: 'Oculus Browser'
|
397
|
+
|
391
398
|
# Samsung Internet (based on Chrome, but lacking some features)
|
392
399
|
- regex: '(SamsungBrowser)/(\d+)\.(\d+)'
|
393
400
|
family_replacement: 'Samsung Internet'
|
@@ -921,7 +928,7 @@ user_agent_parsers:
|
|
921
928
|
# AFTER THE EDGE CASES ABOVE!
|
922
929
|
# AFTER IE11
|
923
930
|
# BEFORE all other IE
|
924
|
-
- regex: '(Firefox)/(\d+)\.(\d+)
|
931
|
+
- regex: '(Firefox)/(\d+)\.(\d+)(?:\.(\d+)|$)'
|
925
932
|
- regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*|)'
|
926
933
|
|
927
934
|
|
@@ -961,7 +968,9 @@ user_agent_parsers:
|
|
961
968
|
- regex: '(Python/3\.\d{1,3} aiohttp)/(\d+)\.(\d+)\.(\d+)'
|
962
969
|
family_replacement: 'Python aiohttp'
|
963
970
|
|
964
|
-
- regex: '(Java)[/ ]?\d
|
971
|
+
- regex: '(Java)[/ ]?\d{1}\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+|)'
|
972
|
+
|
973
|
+
- regex: '(Java)[/ ]?(\d+)\.(\d+)\.(\d+)'
|
965
974
|
|
966
975
|
# minio-go (https://github.com/minio/minio-go)
|
967
976
|
- regex: '(minio-go)/v(\d+)\.(\d+)\.(\d+)'
|
@@ -1077,8 +1086,8 @@ os_parsers:
|
|
1077
1086
|
# generic HbbTV, hoping to catch manufacturer name (always after 2nd comma) and the first string that looks like a 2011-2019 year
|
1078
1087
|
- regex: 'HbbTV/\d+\.\d+\.\d+ \(.{0,30}; ?([a-zA-Z]+) ?;.{0,30}(201[1-9]).{0,30}\)'
|
1079
1088
|
|
1080
|
-
# aspiegel.com spider (owned by Huawei)
|
1081
|
-
- regex: 'AspiegelBot'
|
1089
|
+
# aspiegel.com spider (owned by Huawei, later renamed PetalBot)
|
1090
|
+
- regex: 'AspiegelBot|PetalBot'
|
1082
1091
|
os_replacement: 'Other'
|
1083
1092
|
|
1084
1093
|
##########
|
@@ -1145,6 +1154,12 @@ os_parsers:
|
|
1145
1154
|
- regex: '(android)\s(?:mobile\/)(\d+)(?:\.(\d+)(?:\.(\d+)|)|)'
|
1146
1155
|
os_replacement: 'Android'
|
1147
1156
|
|
1157
|
+
##########
|
1158
|
+
# Meta Quest
|
1159
|
+
##########
|
1160
|
+
- regex: 'Quest'
|
1161
|
+
os_replacement: 'Android'
|
1162
|
+
|
1148
1163
|
##########
|
1149
1164
|
# Kindle Android
|
1150
1165
|
##########
|
@@ -1595,6 +1610,29 @@ os_parsers:
|
|
1595
1610
|
- regex: 'CFNetwork/.{0,100} Darwin/(21)\.\d+'
|
1596
1611
|
os_replacement: 'iOS'
|
1597
1612
|
os_v1_replacement: '15'
|
1613
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.0\.\d+'
|
1614
|
+
os_replacement: 'iOS'
|
1615
|
+
os_v1_replacement: '16'
|
1616
|
+
os_v2_replacement: '0'
|
1617
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.1\.\d+'
|
1618
|
+
os_replacement: 'iOS'
|
1619
|
+
os_v1_replacement: '16'
|
1620
|
+
os_v2_replacement: '1'
|
1621
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.2\.\d+'
|
1622
|
+
os_replacement: 'iOS'
|
1623
|
+
os_v1_replacement: '16'
|
1624
|
+
os_v2_replacement: '2'
|
1625
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.3\.\d+'
|
1626
|
+
os_replacement: 'iOS'
|
1627
|
+
os_v1_replacement: '16'
|
1628
|
+
os_v2_replacement: '3'
|
1629
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.4\.\d+'
|
1630
|
+
os_replacement: 'iOS'
|
1631
|
+
os_v1_replacement: '16'
|
1632
|
+
os_v2_replacement: '4'
|
1633
|
+
- regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+'
|
1634
|
+
os_replacement: 'iOS'
|
1635
|
+
os_v1_replacement: '16'
|
1598
1636
|
- regex: 'CFNetwork/.{0,100} Darwin/'
|
1599
1637
|
os_replacement: 'iOS'
|
1600
1638
|
|
@@ -1823,11 +1861,11 @@ device_parsers:
|
|
1823
1861
|
brand_replacement: 'Spider'
|
1824
1862
|
|
1825
1863
|
# aspiegel.com spider (owned by Huawei)
|
1826
|
-
- regex: 'Mozilla.{1,100}Mobile.{1,100}AspiegelBot'
|
1864
|
+
- regex: 'Mozilla.{1,100}Mobile.{1,100}(AspiegelBot|PetalBot)'
|
1827
1865
|
device_replacement: 'Spider'
|
1828
1866
|
brand_replacement: 'Spider'
|
1829
1867
|
model_replacement: 'Smartphone'
|
1830
|
-
- regex: 'Mozilla.{0,200}AspiegelBot'
|
1868
|
+
- regex: 'Mozilla.{0,200}(AspiegelBot|PetalBot)'
|
1831
1869
|
device_replacement: 'Spider'
|
1832
1870
|
brand_replacement: 'Spider'
|
1833
1871
|
model_replacement: 'Desktop'
|
@@ -3540,6 +3578,25 @@ device_parsers:
|
|
3540
3578
|
brand_replacement: 'Meizu'
|
3541
3579
|
model_replacement: '$1'
|
3542
3580
|
|
3581
|
+
#########
|
3582
|
+
# Meta
|
3583
|
+
# @ref: https://www.meta.com
|
3584
|
+
#########
|
3585
|
+
- regex: 'Quest 2'
|
3586
|
+
device_replacement: 'Quest'
|
3587
|
+
brand_replacement: 'Meta'
|
3588
|
+
model_replacement: 'Quest 2'
|
3589
|
+
|
3590
|
+
- regex: 'Quest Pro'
|
3591
|
+
device_replacement: 'Quest'
|
3592
|
+
brand_replacement: 'Meta'
|
3593
|
+
model_replacement: 'Quest Pro'
|
3594
|
+
|
3595
|
+
- regex: 'Quest'
|
3596
|
+
device_replacement: 'Quest'
|
3597
|
+
brand_replacement: 'Meta'
|
3598
|
+
model_replacement: 'Quest'
|
3599
|
+
|
3543
3600
|
#########
|
3544
3601
|
# Micromax
|
3545
3602
|
# @ref: http://www.micromaxinfo.com
|
@@ -5549,7 +5606,7 @@ device_parsers:
|
|
5549
5606
|
device_replacement: 'Motorola$2'
|
5550
5607
|
brand_replacement: 'Motorola'
|
5551
5608
|
model_replacement: '$2'
|
5552
|
-
|
5609
|
+
|
5553
5610
|
|
5554
5611
|
##########
|
5555
5612
|
# nintendo
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_agent_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Lucas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
A simple, comprehensive Ruby gem for parsing user agent strings
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
|
-
rubygems_version: 3.4.
|
51
|
+
rubygems_version: 3.4.13
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Parsing user agent strings with the help of BrowserScope's UA database
|