user_agent_parser 2.13.0 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/user_agent_parser/parser.rb +30 -30
- data/vendor/uap-core/regexes.yaml +84 -19
- 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: fdc5b924cd5f11fa40712079c1bfa1aeed05171fcfe764293891d5692c0279c2
|
4
|
+
data.tar.gz: fc490168e565d73ad85f278780536641ce519a1b45ab9a52391b85d33c45b171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6cbf21d3149089e420a32e2f97f205eac6ef6189767bd3b28e42f9c9189dbbcf46c83b02ebaad5916d621a1494e4300339bfc8e2da688c7017a810cab6430a2
|
7
|
+
data.tar.gz: 967b44d72866580bbc24dcd772547e53b13def915207c3848c68035d07a621ffec3bd4da76e95218fe1639316cca3458b89206dd19a1e90b497d2cc5a3957a3a
|
@@ -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+)|)$'
|
@@ -214,14 +217,14 @@ user_agent_parsers:
|
|
214
217
|
family_replacement: 'Twitter'
|
215
218
|
|
216
219
|
# Phantom app
|
217
|
-
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Phantom\/ios|android).(\d+)\.(\d+)\.(\d+)'
|
220
|
+
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Phantom\/ios|Phantom\/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
|
@@ -385,9 +388,13 @@ user_agent_parsers:
|
|
385
388
|
# Edge Mobile
|
386
389
|
- regex: 'Windows Phone .{0,200}(Edge)/(\d+)\.(\d+)'
|
387
390
|
family_replacement: 'Edge Mobile'
|
388
|
-
- regex: '(EdgiOS|EdgA)/(\d+)
|
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'
|
@@ -450,6 +457,12 @@ user_agent_parsers:
|
|
450
457
|
- regex: '(Tenta/)(\d+)\.(\d+)\.(\d+)'
|
451
458
|
family_replacement: 'Tenta Browser'
|
452
459
|
|
460
|
+
# Ecosia on iOS / Android
|
461
|
+
- regex: '(Ecosia) ios@(\d+)\.(\d+)\.(\d+)\.(\d+)'
|
462
|
+
family_replacement: 'Ecosia iOS'
|
463
|
+
- regex: '(Ecosia) android@(\d+)\.(\d+)\.(\d+)\.(\d+)'
|
464
|
+
family_replacement: 'Ecosia Android'
|
465
|
+
|
453
466
|
# Chrome Mobile
|
454
467
|
- regex: 'Version/.{1,300}(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
|
455
468
|
family_replacement: 'Chrome Mobile WebView'
|
@@ -457,7 +470,7 @@ user_agent_parsers:
|
|
457
470
|
family_replacement: 'Chrome Mobile WebView'
|
458
471
|
- regex: '(CrMo)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
|
459
472
|
family_replacement: 'Chrome Mobile'
|
460
|
-
- regex: '(CriOS)/(\d+)
|
473
|
+
- regex: '(CriOS)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)'
|
461
474
|
family_replacement: 'Chrome Mobile iOS'
|
462
475
|
- regex: '(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+) Mobile(?:[ /]|$)'
|
463
476
|
family_replacement: 'Chrome Mobile'
|
@@ -921,7 +934,7 @@ user_agent_parsers:
|
|
921
934
|
# AFTER THE EDGE CASES ABOVE!
|
922
935
|
# AFTER IE11
|
923
936
|
# BEFORE all other IE
|
924
|
-
- regex: '(Firefox)/(\d+)\.(\d+)
|
937
|
+
- regex: '(Firefox)/(\d+)\.(\d+)(?:\.(\d+)|$)'
|
925
938
|
- regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*|)'
|
926
939
|
|
927
940
|
|
@@ -932,7 +945,7 @@ user_agent_parsers:
|
|
932
945
|
family_replacement: 'Python Requests'
|
933
946
|
|
934
947
|
# headless user-agents
|
935
|
-
- regex: '\b(Windows-Update-Agent|WindowsPowerShell|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|wget2|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia|fetch libfetch|akka-http|got|CloudCockpitBackend|ReactorNetty|axios|Jersey|Vert.x-WebClient|Apache-CXF|Go-CF-client|go-resty|AHC)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)'
|
948
|
+
- regex: '\b(Windows-Update-Agent|WindowsPowerShell|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|wget2|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia|fetch libfetch|akka-http|got|CloudCockpitBackend|ReactorNetty|axios|Jersey|Vert.x-WebClient|Apache-CXF|Go-CF-client|go-resty|AHC|HTTPie)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)'
|
936
949
|
|
937
950
|
# CloudFoundry
|
938
951
|
- regex: '^(cf)\/(\d+)\.(\d+)\.(\S+)'
|
@@ -961,7 +974,9 @@ user_agent_parsers:
|
|
961
974
|
- regex: '(Python/3\.\d{1,3} aiohttp)/(\d+)\.(\d+)\.(\d+)'
|
962
975
|
family_replacement: 'Python aiohttp'
|
963
976
|
|
964
|
-
- regex: '(Java)[/ ]?\d
|
977
|
+
- regex: '(Java)[/ ]?\d{1}\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+|)'
|
978
|
+
|
979
|
+
- regex: '(Java)[/ ]?(\d+)\.(\d+)\.(\d+)'
|
965
980
|
|
966
981
|
# minio-go (https://github.com/minio/minio-go)
|
967
982
|
- regex: '(minio-go)/v(\d+)\.(\d+)\.(\d+)'
|
@@ -1013,10 +1028,12 @@ user_agent_parsers:
|
|
1013
1028
|
# HTTrack crawler
|
1014
1029
|
- regex: '\b(HTTrack) (\d+)\.(\d+)(?:[\.\-](\d+)|)'
|
1015
1030
|
|
1016
|
-
#
|
1017
|
-
# https://github.com/SerenityOS/serenity/blob/
|
1018
|
-
- regex: '
|
1019
|
-
|
1031
|
+
# Ladybird Browser (https://ladybird.dev)
|
1032
|
+
# https://github.com/SerenityOS/serenity/blob/6a662e0d43810c1dbd56fbf0c123f258aa1d694e/Userland/Libraries/LibWeb/Loader/ResourceLoader.h#L64
|
1033
|
+
- regex: '(Ladybird)\/(\d+)\.(\d+)'
|
1034
|
+
|
1035
|
+
# MullvadBrowser (https://mullvad.net/en/browser)
|
1036
|
+
- regex: '(MullvadBrowser)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)'
|
1020
1037
|
|
1021
1038
|
os_parsers:
|
1022
1039
|
##########
|
@@ -1077,8 +1094,8 @@ os_parsers:
|
|
1077
1094
|
# generic HbbTV, hoping to catch manufacturer name (always after 2nd comma) and the first string that looks like a 2011-2019 year
|
1078
1095
|
- regex: 'HbbTV/\d+\.\d+\.\d+ \(.{0,30}; ?([a-zA-Z]+) ?;.{0,30}(201[1-9]).{0,30}\)'
|
1079
1096
|
|
1080
|
-
# aspiegel.com spider (owned by Huawei)
|
1081
|
-
- regex: 'AspiegelBot'
|
1097
|
+
# aspiegel.com spider (owned by Huawei, later renamed PetalBot)
|
1098
|
+
- regex: 'AspiegelBot|PetalBot'
|
1082
1099
|
os_replacement: 'Other'
|
1083
1100
|
|
1084
1101
|
##########
|
@@ -1145,6 +1162,12 @@ os_parsers:
|
|
1145
1162
|
- regex: '(android)\s(?:mobile\/)(\d+)(?:\.(\d+)(?:\.(\d+)|)|)'
|
1146
1163
|
os_replacement: 'Android'
|
1147
1164
|
|
1165
|
+
##########
|
1166
|
+
# Meta Quest
|
1167
|
+
##########
|
1168
|
+
- regex: 'Quest'
|
1169
|
+
os_replacement: 'Android'
|
1170
|
+
|
1148
1171
|
##########
|
1149
1172
|
# Kindle Android
|
1150
1173
|
##########
|
@@ -1595,6 +1618,29 @@ os_parsers:
|
|
1595
1618
|
- regex: 'CFNetwork/.{0,100} Darwin/(21)\.\d+'
|
1596
1619
|
os_replacement: 'iOS'
|
1597
1620
|
os_v1_replacement: '15'
|
1621
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.0\.\d+'
|
1622
|
+
os_replacement: 'iOS'
|
1623
|
+
os_v1_replacement: '16'
|
1624
|
+
os_v2_replacement: '0'
|
1625
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.1\.\d+'
|
1626
|
+
os_replacement: 'iOS'
|
1627
|
+
os_v1_replacement: '16'
|
1628
|
+
os_v2_replacement: '1'
|
1629
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.2\.\d+'
|
1630
|
+
os_replacement: 'iOS'
|
1631
|
+
os_v1_replacement: '16'
|
1632
|
+
os_v2_replacement: '2'
|
1633
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.3\.\d+'
|
1634
|
+
os_replacement: 'iOS'
|
1635
|
+
os_v1_replacement: '16'
|
1636
|
+
os_v2_replacement: '3'
|
1637
|
+
- regex: 'CFNetwork/.{0,100} Darwin/22\.4\.\d+'
|
1638
|
+
os_replacement: 'iOS'
|
1639
|
+
os_v1_replacement: '16'
|
1640
|
+
os_v2_replacement: '4'
|
1641
|
+
- regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+'
|
1642
|
+
os_replacement: 'iOS'
|
1643
|
+
os_v1_replacement: '16'
|
1598
1644
|
- regex: 'CFNetwork/.{0,100} Darwin/'
|
1599
1645
|
os_replacement: 'iOS'
|
1600
1646
|
|
@@ -1823,11 +1869,11 @@ device_parsers:
|
|
1823
1869
|
brand_replacement: 'Spider'
|
1824
1870
|
|
1825
1871
|
# aspiegel.com spider (owned by Huawei)
|
1826
|
-
- regex: 'Mozilla.{1,100}Mobile.{1,100}AspiegelBot'
|
1872
|
+
- regex: 'Mozilla.{1,100}Mobile.{1,100}(AspiegelBot|PetalBot)'
|
1827
1873
|
device_replacement: 'Spider'
|
1828
1874
|
brand_replacement: 'Spider'
|
1829
1875
|
model_replacement: 'Smartphone'
|
1830
|
-
- regex: 'Mozilla.{0,200}AspiegelBot'
|
1876
|
+
- regex: 'Mozilla.{0,200}(AspiegelBot|PetalBot)'
|
1831
1877
|
device_replacement: 'Spider'
|
1832
1878
|
brand_replacement: 'Spider'
|
1833
1879
|
model_replacement: 'Desktop'
|
@@ -3540,6 +3586,25 @@ device_parsers:
|
|
3540
3586
|
brand_replacement: 'Meizu'
|
3541
3587
|
model_replacement: '$1'
|
3542
3588
|
|
3589
|
+
#########
|
3590
|
+
# Meta
|
3591
|
+
# @ref: https://www.meta.com
|
3592
|
+
#########
|
3593
|
+
- regex: 'Quest 2'
|
3594
|
+
device_replacement: 'Quest'
|
3595
|
+
brand_replacement: 'Meta'
|
3596
|
+
model_replacement: 'Quest 2'
|
3597
|
+
|
3598
|
+
- regex: 'Quest Pro'
|
3599
|
+
device_replacement: 'Quest'
|
3600
|
+
brand_replacement: 'Meta'
|
3601
|
+
model_replacement: 'Quest Pro'
|
3602
|
+
|
3603
|
+
- regex: 'Quest'
|
3604
|
+
device_replacement: 'Quest'
|
3605
|
+
brand_replacement: 'Meta'
|
3606
|
+
model_replacement: 'Quest'
|
3607
|
+
|
3543
3608
|
#########
|
3544
3609
|
# Micromax
|
3545
3610
|
# @ref: http://www.micromaxinfo.com
|
@@ -5549,7 +5614,7 @@ device_parsers:
|
|
5549
5614
|
device_replacement: 'Motorola$2'
|
5550
5615
|
brand_replacement: 'Motorola'
|
5551
5616
|
model_replacement: '$2'
|
5552
|
-
|
5617
|
+
|
5553
5618
|
|
5554
5619
|
##########
|
5555
5620
|
# nintendo
|
@@ -5558,7 +5623,7 @@ device_parsers:
|
|
5558
5623
|
device_replacement: 'Nintendo Wii U'
|
5559
5624
|
brand_replacement: 'Nintendo'
|
5560
5625
|
model_replacement: 'Wii U'
|
5561
|
-
- regex: 'Nintendo (DS|3DS|DSi|Wii);'
|
5626
|
+
- regex: 'Nintendo (Switch|DS|3DS|DSi|Wii);'
|
5562
5627
|
device_replacement: 'Nintendo $1'
|
5563
5628
|
brand_replacement: 'Nintendo'
|
5564
5629
|
model_replacement: '$1'
|
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.17.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:
|
11
|
+
date: 2024-02-24 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.
|
51
|
+
rubygems_version: 3.5.6
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Parsing user agent strings with the help of BrowserScope's UA database
|