user_agent_parser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of user_agent_parser might be problematic. Click here for more details.

@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Tim Lucas
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,76 @@
1
+ # UserAgentParser
2
+
3
+ UserAgentParser is a simple, comprehensive Ruby gem for parsing user agent strings. It utilises [BrowserScope](http://www.browserscope.org/)'s UA parser via the most excellent [ua-parser project](https://github.com/tobie/ua-parser) by [Tobie Langel](https://github.com/tobie/).
4
+
5
+ ## Requirements
6
+
7
+ * Ruby >= 1.9.2
8
+
9
+ Ruby 1.8.7 is not supported due to the requirement for the newer psych YAML parser. If you can get it working on 1.8.7 please send a pull request.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ $ gem install user_agent_parser
15
+ ```
16
+
17
+ ## Example usage
18
+
19
+ ```ruby
20
+ require 'user_agent_parser'
21
+ => true
22
+ ua = UserAgentParser.parse 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0;)'
23
+ => #<UserAgentParser::UserAgent IE 9.0 (Windows Vista)>
24
+ ua.to_s
25
+ => "IE 9.0 (Windows Vista)"
26
+ ua.family
27
+ => "IE"
28
+ ua.version.to_s
29
+ => "9.0"
30
+ ua.version[0]
31
+ => 9
32
+ ua.version[1]
33
+ => 0
34
+ ua.os.name
35
+ => "Windows Vista"
36
+ ```
37
+
38
+ ## The pattern database
39
+
40
+ The [ua-parser database](https://github.com/tobie/ua-parser/blob/master/regexes.yaml) is included via a [git submodule](http://help.github.com/submodules/). To update the database the submodule needs to be updated and the gem re-released (pull requests for this are very welcome!).
41
+
42
+ You can also specify the path to your own, updated and/or customised `regexes.yaml` file:
43
+
44
+ ```ruby
45
+ UserAgentParser.patterns_path = '/some/path/to/regexes.yaml'
46
+ ```
47
+
48
+ ## Comprehensive you say?
49
+
50
+ ```bash
51
+ $ rake test
52
+ ...
53
+
54
+ Finished tests in 144.220280s, 89.0027 tests/s, 234.9739 assertions/s.
55
+
56
+ 12836 tests, 33888 assertions, 0 failures, 0 errors, 0 skips
57
+ ```
58
+
59
+ ## Limitations
60
+
61
+ Unlike the original Browserscope code there's no support for providing overrides from Javascript user agent detection. There's no current intention of adding support as the Javascript overrides were only necessary for IE 9 Platform Preview and older versions of [Chrome Frame](https://developers.google.com/chrome/chrome-frame/).
62
+
63
+ Chrome Frame detection is not yet included, but once [ua-parser issue #14](https://github.com/tobie/ua-parser/issues/14) is resolved this gem will be updated along with it.
64
+
65
+ ## Contributing
66
+
67
+ 1. Fork
68
+ 2. Hack
69
+ 3. `rake test`
70
+ 4. Send a pull request
71
+
72
+ All accepted pull requests will earn you commit and release rights.
73
+
74
+ ## License
75
+
76
+ MIT
@@ -0,0 +1,732 @@
1
+ ### THIS FILE WAS COPIED ON JAN 26 2012.
2
+ ### ORIGINAL IS AT: http://code.google.com/p/ua-parser/source/browse/trunk/resources/user_agent_parser.yaml
3
+ ### Please review the CHANGELOG to see how this file differs from the original
4
+ user_agent_parsers:
5
+ #### SPECIAL CASES TOP ####
6
+
7
+ # must go before Opera
8
+ - regex: '^(Opera)/(\d+)\.(\d+) \(Nintendo Wii'
9
+ family_replacement: 'Wii'
10
+
11
+ # must go before Firefox to catch SeaMonkey/Camino
12
+ - regex: '(SeaMonkey|Camino)/(\d+)\.(\d+)\.?([ab]?\d+[a-z]*)'
13
+
14
+ # Firefox
15
+ - regex: '(Fennec)/(\d+)\.(\d+)\.?([ab]?\d+[a-z]*)'
16
+ family_replacement: 'Firefox Mobile'
17
+ - regex: '(Fennec)/(\d+)\.(\d+)(pre)'
18
+ family_replacment: 'Firefox Mobile'
19
+ - regex: '(Fennec)/(\d+)\.(\d+)'
20
+ family_replacement: 'Firefox Mobile'
21
+ - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)\.(\d+(?:pre)?)'
22
+ family_replacement: 'Firefox ($1)'
23
+ - regex: '(Firefox)/(\d+)\.(\d+)([ab]\d+[a-z]*)'
24
+ family_replacement: 'Firefox Beta'
25
+ - regex: '(Firefox)-(?:\d+\.\d+)?/(\d+)\.(\d+)([ab]\d+[a-z]*)'
26
+ family_replacement: 'Firefox Beta'
27
+ - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)([ab]\d+[a-z]*)?'
28
+ family_replacement: 'Firefox ($1)'
29
+ - regex: '(Firefox).*Tablet browser (\d+)\.(\d+)\.(\d+)'
30
+ family_replacement: 'MicroB'
31
+ - regex: '(MozillaDeveloperPreview)/(\d+)\.(\d+)([ab]\d+[a-z]*)?'
32
+
33
+ # e.g.: Flock/2.0b2
34
+ - regex: '(Flock)/(\d+)\.(\d+)(b\d+?)'
35
+
36
+ # RockMelt
37
+ - regex: '(RockMelt)/(\d+)\.(\d+)\.(\d+)'
38
+
39
+ # e.g.: Fennec/0.9pre
40
+ - regex: '(Navigator)/(\d+)\.(\d+)\.(\d+)'
41
+ family_replacement: 'Netscape'
42
+
43
+ - regex: '(Navigator)/(\d+)\.(\d+)([ab]\d+)'
44
+ family_replacement: 'Netscape'
45
+
46
+ - regex: '(Netscape6)/(\d+)\.(\d+)\.(\d+)'
47
+ family_replacement: 'Netscape'
48
+
49
+ - regex: '(MyIBrow)/(\d+)\.(\d+)'
50
+ family_replacement: 'My Internet Browser'
51
+
52
+ # Opera will stop at 9.80 and hide the real version in the Version string.
53
+ # see: http://dev.opera.com/articles/view/opera-ua-string-changes/
54
+ - regex: '(Opera Tablet).*Version/(\d+)\.(\d+)(?:\.(\d+))?'
55
+ - regex: '(Opera)/.+Opera Mobi.+Version/(\d+)\.(\d+)'
56
+ family_replacement: 'Opera Mobile'
57
+ - regex: 'Opera Mobi'
58
+ family_replacement: 'Opera Mobile'
59
+ - regex: '(Opera Mini)/(\d+)\.(\d+)'
60
+ - regex: '(Opera Mini)/att/(\d+)\.(\d+)'
61
+ - regex: '(Opera)/9.80.*Version/(\d+)\.(\d+)(?:\.(\d+))?'
62
+
63
+ # Palm WebOS looks a lot like Safari.
64
+ - regex: '(webOSBrowser)/(\d+)\.(\d+)'
65
+ - regex: '(webOS)/(\d+)\.(\d+)'
66
+ family_replacement: 'webOSBrowser'
67
+ - regex: '(wOSBrowser).+TouchPad/(\d+)\.(\d+)'
68
+ family_replacement: 'webOS TouchPad'
69
+
70
+ # LuaKit has no version info.
71
+ # http://luakit.org/projects/luakit/
72
+ - regex: '(luakit)'
73
+ family_replacement: 'LuaKit'
74
+
75
+ # Lightning (for Thunderbird)
76
+ # http://www.mozilla.org/projects/calendar/lightning/
77
+ - regex: '(Lightning)/(\d+)\.(\d+)([ab]?\d+[a-z]*)'
78
+
79
+ # Swiftfox
80
+ - regex: '(Firefox)/(\d+)\.(\d+)\.(\d+(?:pre)?) \(Swiftfox\)'
81
+ family_replacement: 'Swiftfox'
82
+ - regex: '(Firefox)/(\d+)\.(\d+)([ab]\d+[a-z]*)? \(Swiftfox\)'
83
+ family_replacement: 'Swiftfox'
84
+
85
+ # Rekonq
86
+ - regex: 'rekonq'
87
+ family_replacement: 'Rekonq'
88
+
89
+ # Conkeror lowercase/uppercase
90
+ # http://conkeror.org/
91
+ - regex: '(conkeror|Conkeror)/(\d+)\.(\d+)\.?(\d+)?'
92
+ family_replacement: 'Conkeror'
93
+
94
+ # catches lower case konqueror
95
+ - regex: '(konqueror)/(\d+)\.(\d+)\.(\d+)'
96
+ family_replacement: 'Konqueror'
97
+
98
+ - regex: '(WeTab)-Browser'
99
+
100
+ - regex: '(Comodo_Dragon)/(\d+)\.(\d+)\.(\d+)'
101
+ family_replacement: 'Comodo Dragon'
102
+
103
+ # YottaaMonitor bot
104
+ - regex: '(YottaaMonitor)'
105
+
106
+ # must go before NetFront below
107
+ - regex: '(Kindle)/(\d+)\.(\d+)'
108
+
109
+ - regex: '(Symphony) (\d+).(\d+)'
110
+
111
+ - regex: 'Minimo'
112
+
113
+ # Chrome Mobile
114
+ - regex: '(CrMo)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
115
+ family_replacement: 'Chrome Mobile'
116
+
117
+ # UC Browser
118
+ - regex: '(UC Browser)(\d+)\.(\d+)\.(\d+)'
119
+
120
+ #### END SPECIAL CASES TOP ####
121
+
122
+ #### MAIN CASES - this catches > 50% of all browsers ####
123
+
124
+ # Browser/major_version.minor_version.beta_version
125
+ - regex: '(AdobeAIR|Chromium|FireWeb|Jasmine|ANTGalio|Midori|Fresco|Lobo|PaleMoon|Maxthon|Lynx|OmniWeb|Dillo|Camino|Demeter|Fluid|Fennec|Shiira|Sunrise|Chrome|Flock|Netscape|Lunascape|Epiphany|WebPilot|NetFront|Netfront|Konqueror|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|Opera Mini|iCab|NetNewsWire|ThunderBrowse|Iron|Iris|UP\.Browser|Bunjaloo)/(\d+)\.(\d+)\.(\d+)'
126
+
127
+ # Browser/major_version.minor_version
128
+ - regex: '(Bolt|Jasmine|IceCat|Skyfire|Midori|Maxthon|Lynx|Arora|IBrowse|Dillo|Camino|Shiira|Fennec|Phoenix|Chrome|Flock|Netscape|Lunascape|Epiphany|WebPilot|Opera Mini|Opera|NetFront|Netfront|Konqueror|Googlebot|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|iCab|NetNewsWire|Iron|Space Bison|Stainless|Orca|Dolfin|BOLT|Minimo)/(\d+)\.(\d+)'
129
+
130
+ # Browser major_version.minor_version.beta_version (space instead of slash)
131
+ - regex: '(iRider|Crazy Browser|SkipStone|iCab|Lunascape|Sleipnir|Maemo Browser) (\d+)\.(\d+)\.(\d+)'
132
+ # Browser major_version.minor_version (space instead of slash)
133
+ - regex: '(iCab|Lunascape|Opera|Android|Jasmine|Polaris|BREW) (\d+)\.(\d+)\.?(\d+)?'
134
+
135
+ # weird android UAs
136
+ - regex: '(Android) Donut'
137
+ v1_replacement: '1'
138
+ v2_replacement: '2'
139
+
140
+ - regex: '(Android) Eclair'
141
+ v1_replacement: '2'
142
+ v2_replacement: '1'
143
+
144
+ - regex: '(Android) Froyo'
145
+ v1_replacement: '2'
146
+ v2_replacement: '2'
147
+
148
+ - regex: '(Android) Gingerbread'
149
+ v1_replacement: '2'
150
+ v2_replacement: '3'
151
+
152
+ - regex: '(Android) Honeycomb'
153
+ v1_replacement: '3'
154
+
155
+ # IE Mobile
156
+ - regex: '(IEMobile)[ /](\d+)\.(\d+)'
157
+ family_replacement: 'IE Mobile'
158
+ # desktop mode
159
+ # http://www.anandtech.com/show/3982/windows-phone-7-review
160
+ - regex: '(MSIE) (\d+)\.(\d+).*XBLWP7'
161
+ family_replacement: 'IE Large Screen'
162
+
163
+ # AFTER THE EDGE CASES ABOVE!
164
+ - regex: '(Firefox)/(\d+)\.(\d+)\.(\d+)'
165
+ - regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*)?'
166
+
167
+ #### END MAIN CASES ####
168
+
169
+ #### SPECIAL CASES ####
170
+ - regex: '(Obigo)InternetBrowser'
171
+ - regex: '(Obigo)\-Browser'
172
+ - regex: '(Obigo|OBIGO)[^\d]*(\d+)(?:.(\d+))?'
173
+
174
+ - regex: '(MAXTHON|Maxthon) (\d+)\.(\d+)'
175
+ family_replacement: 'Maxthon'
176
+ - regex: '(Maxthon|MyIE2|Uzbl|Shiira)'
177
+ v1_replacement: '0'
178
+
179
+ - regex: '(PLAYSTATION) (\d+)'
180
+ family_replacement: 'PlayStation'
181
+ - regex: '(PlayStation Portable)[^\d]+(\d+).(\d+)'
182
+
183
+ - regex: '(BrowseX) \((\d+)\.(\d+)\.(\d+)'
184
+
185
+ - regex: '(POLARIS)/(\d+)\.(\d+)'
186
+ family_replacement: 'Polaris'
187
+ - regex: '(Embider)/(\d+)\.(\d+)'
188
+ family_replacement: 'Polaris'
189
+
190
+ - regex: '(BonEcho)/(\d+)\.(\d+)\.(\d+)'
191
+ family_replacement: 'Bon Echo'
192
+
193
+ - regex: '(iPod).+Version/(\d+)\.(\d+)\.(\d+)'
194
+ family_replacement: 'Mobile Safari'
195
+ - regex: '(iPod).*Version/(\d+)\.(\d+)'
196
+ family_replacement: 'Mobile Safari'
197
+ - regex: '(iPod)'
198
+ family_replacement: 'Mobile Safari'
199
+ - regex: '(iPhone).*Version/(\d+)\.(\d+)\.(\d+)'
200
+ family_replacement: 'Mobile Safari'
201
+ - regex: '(iPhone).*Version/(\d+)\.(\d+)'
202
+ family_replacement: 'Mobile Safari'
203
+ - regex: '(iPhone)'
204
+ family_replacement: 'Mobile Safari'
205
+ - regex: '(iPad).*Version/(\d+)\.(\d+)\.(\d+)'
206
+ family_replacement: 'Mobile Safari'
207
+ - regex: '(iPad).*Version/(\d+)\.(\d+)'
208
+ family_replacement: 'Mobile Safari'
209
+ - regex: '(iPad)'
210
+ family_replacement: 'Mobile Safari'
211
+
212
+ - regex: '(AvantGo) (\d+).(\d+)'
213
+
214
+ - regex: '(Avant)'
215
+ v1_replacement: '1'
216
+
217
+ # nokia browsers
218
+ # based on: http://www.developer.nokia.com/Community/Wiki/User-Agent_headers_for_Nokia_devices
219
+ - regex: '^(Nokia)'
220
+ family_replacement: 'Nokia Services (WAP) Browser'
221
+ - regex: '(NokiaBrowser)/(\d+)\.(\d+).(\d+)\.(\d+)'
222
+ - regex: '(NokiaBrowser)/(\d+)\.(\d+).(\d+)'
223
+ - regex: '(NokiaBrowser)/(\d+)\.(\d+)'
224
+ - regex: '(BrowserNG)/(\d+)\.(\d+).(\d+)'
225
+ family_replacement: 'NokiaBrowser'
226
+ - regex: '(Series60)/5\.0'
227
+ family_replacement: 'NokiaBrowser'
228
+ v1_replacement: '7'
229
+ v2_replacement: '0'
230
+ - regex: '(Series60)/(\d+)\.(\d+)'
231
+ family_replacement: 'Nokia OSS Browser'
232
+ - regex: '(S40OviBrowser)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
233
+ family_replacement: 'Nokia Series 40 Ovi Browser'
234
+ - regex: '(Nokia)[EN]?(\d+)'
235
+
236
+ # BlackBerry devices
237
+ - regex: '(PlayBook).+RIM Tablet OS (\d+)\.(\d+)\.(\d+)'
238
+ family_replacement: 'Blackberry WebKit'
239
+ - regex: '(Black[bB]erry).+Version/(\d+)\.(\d+)\.(\d+)'
240
+ family_replacement: 'Blackberry WebKit'
241
+ - regex: '(Black[bB]erry)\s?(\d+)'
242
+ family_replacement: 'Blackberry'
243
+
244
+ - regex: '(OmniWeb)/v(\d+)\.(\d+)'
245
+
246
+ - regex: '(Blazer)/(\d+)\.(\d+)'
247
+ family_replacement: 'Palm Blazer'
248
+
249
+ - regex: '(Pre)/(\d+)\.(\d+)'
250
+ family_replacement: 'Palm Pre'
251
+
252
+ - regex: '(Links) \((\d+)\.(\d+)'
253
+
254
+ - regex: '(QtWeb) Internet Browser/(\d+)\.(\d+)'
255
+
256
+ #- regex: '\(iPad;.+(Version)/(\d+)\.(\d+)(?:\.(\d+))?.*Safari/'
257
+ # family_replacement: 'iPad'
258
+
259
+ # Amazon Silk, should go before Safari
260
+ - regex: '(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+))?'
261
+
262
+ # Safari
263
+ - regex: '(Version)/(\d+)\.(\d+)(?:\.(\d+))?.*Safari/'
264
+ family_replacement: 'Safari'
265
+ # Safari didn't provide "Version/d.d.d" prior to 3.0
266
+ - regex: '(Safari)/\d+'
267
+
268
+ - regex: '(OLPC)/Update(\d+)\.(\d+)'
269
+
270
+ - regex: '(OLPC)/Update()\.(\d+)'
271
+ v1_replacement: '0'
272
+
273
+ - regex: '(SEMC\-Browser)/(\d+)\.(\d+)'
274
+
275
+ - regex: '(Teleca)'
276
+ family_replacement: 'Teleca Browser'
277
+
278
+ - regex: '(MSIE) (\d+)\.(\d+)'
279
+ family_replacement: 'IE'
280
+
281
+ os_parsers:
282
+ ##########
283
+ # Windows
284
+ # http://en.wikipedia.org/wiki/Windows_NT#Releases
285
+ # possibility of false positive when different marketing names share same NT kernel
286
+ # e.g. windows server 2003 and windows xp
287
+ # lots of ua strings have Windows NT 4.1 !?!?!?!? !?!? !? !????!?! !!! ??? !?!?! ?
288
+ # (very) roughly ordered in terms of frequency of occurence of regex (win xp currently most frequent, etc)
289
+ ##########
290
+ - regex: '(Windows Phone 6\.5)'
291
+
292
+ - regex: '(Windows (?:NT 5\.2|NT 5\.1))'
293
+ os_replacement: 'Windows XP'
294
+
295
+ # ie mobile des ktop mode
296
+ # spoofs nt 6.1. must come before windows 7
297
+ - regex: '(XBLWP7)'
298
+ os_replacement: 'Windows Phone OS'
299
+
300
+ - regex: '(Windows NT 6\.1)'
301
+ os_replacement: 'Windows 7'
302
+
303
+ - regex: '(Windows NT 6\.0)'
304
+ os_replacement: 'Windows Vista'
305
+
306
+ - regex: '(Windows 98|Windows XP|Windows ME|Windows 95|Windows CE|Windows 7|Windows NT 4\.0|Windows Vista|Windows 2000)'
307
+
308
+ # is this a spoof or is nt 6.2 out and about in some capacity?
309
+ - regex: '(Windows NT 6\.2)'
310
+ os_replacement: 'Windows 8'
311
+
312
+ - regex: '(Windows NT 5\.0)'
313
+ os_replacement: 'Windows 2000'
314
+
315
+ - regex: '(Windows Phone OS) (\d+)\.(\d+)'
316
+
317
+ - regex: '(Windows ?Mobile)'
318
+ os_replacement: 'Windows Mobile'
319
+
320
+ - regex: '(WinNT4.0)'
321
+ os_replacement: 'Windows NT 4.0'
322
+
323
+ - regex: '(Win98)'
324
+ os_replacement: 'Windows 98'
325
+
326
+ ##########
327
+ # Android
328
+ # can actually detect rooted android os. do we care?
329
+ ##########
330
+ - regex: '(Android) (\d+)\.(\d+)(?:[.\-]([a-z0-9]+))?'
331
+ - regex: '(Android)\-(\d+)\.(\d+)(?:[.\-]([a-z0-9]+))?'
332
+
333
+ - regex: '(Android) Donut'
334
+ os_v1_replacement: '1'
335
+ os_v2_replacement: '2'
336
+
337
+ - regex: '(Android) Eclair'
338
+ os_v1_replacement: '2'
339
+ os_v2_replacement: '1'
340
+
341
+ - regex: '(Android) Froyo'
342
+ os_v1_replacement: '2'
343
+ os_v2_replacement: '2'
344
+
345
+ - regex: '(Android) Gingerbread'
346
+ os_v1_replacement: '2'
347
+ os_v2_replacement: '3'
348
+
349
+ - regex: '(Android) Honeycomb'
350
+ os_v1_replacement: '3'
351
+
352
+ ##########
353
+ # Mac OS
354
+ # http://en.wikipedia.org/wiki/Mac_OS_X#Versions
355
+ ##########
356
+ - regex: '(Mac OS X) (\d+)[_.](\d+)(?:[_.](\d+))?'
357
+
358
+ # builds before tiger don't seem to specify version?
359
+
360
+ # ios devices spoof (mac os x), so including intel/ppc prefixes
361
+ - regex: '(?:PPC|Intel) (Mac OS X)'
362
+
363
+ ##########
364
+ # iOS
365
+ # http://en.wikipedia.org/wiki/IOS_version_history
366
+ ##########
367
+ - regex: '(CPU OS|iPhone OS) (\d+)_(\d+)(?:_(\d+))?'
368
+ os_replacement: 'iOS'
369
+
370
+ # remaining cases are mostly only opera uas, so catch opera as to not catch iphone spoofs
371
+ - regex: '(iPhone|iPad|iPod); Opera'
372
+ os_replacement: 'iOS'
373
+
374
+ # few more stragglers
375
+ - regex: '(iPhone|iPad|iPod).*Mac OS X.*Version/(\d+)\.(\d+)'
376
+ os_replacement: 'iOS'
377
+
378
+ ##########
379
+ # Chrome OS
380
+ # if version 0.0.0, probably this stuff:
381
+ # http://code.google.com/p/chromium-os/issues/detail?id=11573
382
+ # http://code.google.com/p/chromium-os/issues/detail?id=13790
383
+ ##########
384
+ - regex: '(CrOS) [a-z0-9_]+ (\d+)\.(\d+)(?:\.(\d+))?'
385
+ os_replacement: 'Chrome OS'
386
+
387
+ ##########
388
+ # Linux distros
389
+ ##########
390
+ - regex: '(Debian)-(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?'
391
+ - regex: '(Linux Mint)(?:/(\d+))?'
392
+ - regex: '(Mandriva)(?: Linux)?/(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?'
393
+
394
+ ##########
395
+ # Symbian + Symbian OS
396
+ # http://en.wikipedia.org/wiki/History_of_Symbian
397
+ ##########
398
+ - regex: '(Symbian[Oo][Ss])/(\d+)\.(\d+)'
399
+ os_replacement: 'Symbian OS'
400
+ - regex: '(Symbian/3).+NokiaBrowser/7\.3'
401
+ os_replacement: 'Symbian^3 Anna'
402
+ - regex: '(Symbian/3).+NokiaBrowser/7\.4'
403
+ os_replacement: 'Symbian^3 Belle'
404
+ - regex: '(Symbian/3)'
405
+ os_replacement: 'Symbian^3'
406
+ - regex: '(Series 60|SymbOS|S60)'
407
+ os_replacement: 'Symbian OS'
408
+ - regex: '(MeeGo)'
409
+ - regex: 'Symbian [Oo][Ss]'
410
+ os_replacement: 'Symbian OS'
411
+
412
+ ##########
413
+ # BlackBerry devices
414
+ ##########
415
+ - regex: '(Black[Bb]erry)[0-9a-z]+/(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?'
416
+ os_replacement: 'BlackBerry OS'
417
+ - regex: '(Black[Bb]erry).+Version/(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?'
418
+ os_replacement: 'BlackBerry OS'
419
+ - regex: '(RIM Tablet OS) (\d+)\.(\d+)\.(\d+)'
420
+ os_replacement: 'BlackBerry Tablet OS'
421
+ - regex: '(Play[Bb]ook)'
422
+ os_replacement: 'BlackBerry Tablet OS'
423
+ - regex: '(Black[Bb]erry)'
424
+ os_replacement: 'Blackberry OS'
425
+
426
+ ##########
427
+ # Misc mobile
428
+ ##########
429
+ - regex: '(webOS|hpwOS)/(\d+)\.(\d+)(?:\.(\d+))?'
430
+ os_replacement: 'webOS'
431
+
432
+ ##########
433
+ # Generic patterns
434
+ # since the majority of os cases are very specific, these go last
435
+ ##########
436
+ # first.second.third.fourth bits
437
+ - regex: '(SUSE|Fedora|Red Hat|PCLinuxOS)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
438
+
439
+ # first.second.third bits
440
+ - regex: '(SUSE|Fedora|Red Hat|Puppy|PCLinuxOS|CentOS)/(\d+)\.(\d+)\.(\d+)'
441
+
442
+ # first.second bits
443
+ - regex: '(Ubuntu|Kindle|Bada|Lubuntu|BackTrack|Red Hat|Slackware)/(\d+)\.(\d+)'
444
+
445
+ # just os
446
+ - regex: '(Windows|OpenBSD|FreeBSD|NetBSD|Ubuntu|Kubuntu|Android|Arch Linux|CentOS|WeTab|Slackware)'
447
+ - regex: '(Linux|BSD)'
448
+
449
+ device_parsers:
450
+ ##########
451
+ # incomplete!
452
+ # multiple replacement placeholds i.e. ($1) ($2) help solve problem of single device with multiple representations in ua
453
+ # e.g. HTC Dream S should parse to the same device as HTC_DreamS
454
+ ##########
455
+
456
+ ##########
457
+ # incomplete!
458
+ # HTC
459
+ # http://en.wikipedia.org/wiki/List_of_HTC_phones
460
+ # this is quickly getting unwieldy
461
+ ##########
462
+ # example: Mozilla/5.0 (Linux; U; Android 2.3.2; fr-fr; HTC HD2 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
463
+ - regex: 'HTC ([A-Z][a-z0-9]+) Build'
464
+ device_replacement: 'HTC $1'
465
+ # example: Mozilla/5.0 (Linux; U; Android 2.1; es-es; HTC Legend 1.23.161.1 Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17,gzip
466
+ - regex: 'HTC ([A-Z][a-z0-9 ]+) \d+\.\d+\.\d+\.\d+'
467
+ device_replacement: 'HTC $1'
468
+ # example: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; HTC_Touch_Diamond2_T5353; Windows Phone 6.5.3.5)
469
+ - regex: 'HTC_Touch_([A-Za-z0-9]+)'
470
+ device_replacement: 'HTC Touch ($1)'
471
+ # should come after HTC_Touch
472
+ - regex: 'USCCHTC(\d+)'
473
+ device_replacement: 'HTC $1 (US Cellular)'
474
+ - regex: 'Sprint APA(9292)'
475
+ device_replacement: 'HTC $1 (Sprint)'
476
+ - regex: 'HTC ([A-Za-z0-9]+ [A-Z])'
477
+ device_replacement: HTC $1
478
+ - regex: 'HTC-([A-Za-z0-9]+)'
479
+ device_replacement: 'HTC $1'
480
+ - regex: 'HTC_([A-Za-z0-9]+)'
481
+ device_replacement: 'HTC $1'
482
+ - regex: 'HTC ([A-Za-z0-9]+)'
483
+ device_replacement: 'HTC $1'
484
+ - regex: '(ADR[A-z0-9]+)'
485
+ device_replacement: 'HTC $1'
486
+ - regex: '(HTC)'
487
+
488
+ #########
489
+ # Ericsson - must come before nokia since they also use symbian
490
+ #########
491
+ - regex: 'SonyEricsson([A-z0-9]+)/'
492
+ device_replacement: 'Ericsson $1'
493
+
494
+ #########
495
+ # Android General Device Matching (far from perfect)
496
+ #########
497
+ - regex: 'Android[\- ][\d]+\.[\d]+\; [A-z]{2}\-[A-z]{2}\; WOWMobile (.+) Build'
498
+ - regex: 'Android[\- ][\d]+\.[\d]+\.[\d]+; [A-z]{2}\-[A-z]{2}\; (.+) Build'
499
+ - regex: 'Android[\- ][\d]+\.[\d]+\-update1\; [A-z]{2}\-[A-z]{2}\; (.+) Build'
500
+ - regex: 'Android[\- ][\d]+\.[\d]+\; [A-z]{2}\-[A-z]{2}\; (.+) Build'
501
+
502
+ ##########
503
+ # NOKIA
504
+ # nokia NokiaN8-00 comes before iphone. sometimes spoofs iphone
505
+ ##########
506
+ - regex: 'NokiaN([0-9]+)'
507
+ device_replacement: 'Nokia N$1'
508
+ - regex: 'Nokia([A-Za-z0-9\v-]+)'
509
+ device_replacement: 'Nokia $1'
510
+ - regex: 'NOKIA ([A-Za-z0-9\-]+)'
511
+ device_replacement: 'Nokia $1'
512
+ - regex: 'Nokia ([A-Za-z0-9\-]+)'
513
+ device_replacement: 'Nokia $1'
514
+ - regex: 'Lumia ([A-Za-z0-9\-]+)'
515
+ device_replacement: 'Lumia $1'
516
+ - regex: 'Symbian'
517
+ device_replacement: 'Nokia'
518
+
519
+ ##########
520
+ # Blackberry
521
+ # http://www.useragentstring.com/pages/BlackBerry/
522
+ ##########
523
+ - regex: '(PlayBook).+RIM Tablet OS'
524
+ device_replacement: 'Blackberry Playbook'
525
+ - regex: '(Black[Bb]erry [0-9]+);'
526
+ - regex: 'Black[Bb]erry([0-9]+)'
527
+ device_replacement: 'BlackBerry $1'
528
+
529
+ ##########
530
+ # PALM / HP
531
+ ##########
532
+ # some palm devices must come before iphone. sometimes spoofs iphone in ua
533
+ - regex: '(Pre)/(\d+)\.(\d+)'
534
+ device_replacement: 'Palm Pre'
535
+ - regex: '(Pixi)/(\d+)\.(\d+)'
536
+ device_replacement: 'Palm Pixi'
537
+ - regex: '(Touchpad)/(\d+)\.(\d+)'
538
+ device_replacement: 'HP Touchpad'
539
+ - regex: 'HPiPAQ([A-z0-9]+)/(\d+).(\d+)'
540
+ device_replacement: 'HP iPAQ $1'
541
+ - regex: 'Palm([A-z0-9]+)'
542
+ device_replacement: 'Palm $1'
543
+ - regex: 'Treo([A-z0-9]+)'
544
+ device_replacement: 'Palm Treo $1'
545
+ - regex: 'webOS.*(P160UNA)/(\d+).(\d+)'
546
+ device_replacement: 'HP Veer'
547
+
548
+ ##########
549
+ # incomplete!
550
+ # Kindle
551
+ ##########
552
+ - regex: '(Kindle Fire)'
553
+ - regex: '(Kindle)'
554
+ - regex: '(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+))?'
555
+ device_replacement: 'Kindle Fire'
556
+
557
+ ##########
558
+ # complete but probably catches spoofs
559
+ # iSTUFF
560
+ ##########
561
+ # ipad and ipod must be parsed before iphone
562
+ # cannot determine specific device type from ua string. (3g, 3gs, 4, etc)
563
+ - regex: '(iPad) Simulator;'
564
+ - regex: '(iPad);'
565
+ - regex: '(iPod);'
566
+ - regex: '(iPhone) Simulator;'
567
+ - regex: '(iPhone);'
568
+
569
+ ##########
570
+ # Acer
571
+ ##########
572
+ - regex: 'acer_([A-z0-9]+)_'
573
+ device_replacement: 'Acer $1'
574
+ - regex: 'acer_([A-z0-9]+)_'
575
+ device_replacement: 'Acer $1'
576
+
577
+ ##########
578
+ # Amoi
579
+ ##########
580
+ - regex: 'Amoi\-([A-z0-9]+)'
581
+ device_replacement: 'Amoi $1'
582
+ - regex: 'AMOI\-([A-z0-9]+)'
583
+ device_replacement: 'Amoi $1'
584
+
585
+ ##########
586
+ # Amoi
587
+ ##########
588
+ - regex: 'Asus\-([A-z0-9]+)'
589
+ device_replacement: 'Asus $1'
590
+ - regex: 'ASUS\-([A-z0-9]+)'
591
+ device_replacement: 'Asus $1'
592
+
593
+ ##########
594
+ # Bird
595
+ ##########
596
+ - regex: 'BIRD\-([A-z0-9]+)'
597
+ device_replacement: 'Bird $1'
598
+ - regex: 'BIRD\.([A-z0-9]+)'
599
+ device_replacement: 'Bird $1'
600
+ - regex: 'BIRD ([A-z0-9]+)'
601
+ device_replacement: 'Bird $1'
602
+
603
+ ##########
604
+ # Dell
605
+ ##########
606
+ - regex: 'Dell ([A-z0-9]+)'
607
+ device_replacement: 'Dell $1'
608
+
609
+ ##########
610
+ # DoCoMo
611
+ ##########
612
+ - regex: 'DoCoMo/2\.0 ([A-z0-9]+)'
613
+ device_replacement: 'DoCoMo $1'
614
+ - regex: '([A-z0-9]+)\_W\;FOMA'
615
+ device_replacement: 'DoCoMo $1'
616
+ - regex: '([A-z0-9]+)\;FOMA'
617
+ device_replacement: 'DoCoMo $1'
618
+
619
+ ##########
620
+ # Huawei Vodafone
621
+ ##########
622
+ - regex: 'vodafone([A-z0-9]+)'
623
+ device_replacement: 'Huawei Vodafone $1'
624
+
625
+ ##########
626
+ # i-mate
627
+ ##########
628
+ - regex: 'i\-mate ([A-z0-9]+)'
629
+ device_replacement: 'i-mate $1'
630
+
631
+ ##########
632
+ # kyocera
633
+ ##########
634
+ - regex: 'Kyocera\-([A-z0-9]+)'
635
+ device_replacement: 'Kyocera $1'
636
+ - regex: 'KWC\-([A-z0-9]+)'
637
+ device_replacement: 'Kyocera $1'
638
+
639
+ ##########
640
+ # lenovo
641
+ ##########
642
+ - regex: 'Lenovo\-([A-z0-9]+)'
643
+ device_replacement: 'Lenovo $1'
644
+ - regex: 'Lenovo\_([A-z0-9]+)'
645
+ device_replacement: 'Lenovo $1'
646
+
647
+ ##########
648
+ # lg
649
+ ##########
650
+ - regex: 'LG/([A-z0-9]+)'
651
+ device_replacement: 'LG $1'
652
+ - regex: 'LG-LG([A-z0-9]+)'
653
+ device_replacement: 'LG $1'
654
+ - regex: 'LGE-LG([A-z0-9]+)'
655
+ device_replacement: 'LG $1'
656
+ - regex: 'LGE VX([A-z0-9]+)'
657
+ device_replacement: 'LG $1'
658
+ - regex: 'LG ([A-z0-9]+)'
659
+ device_replacement: 'LG $1'
660
+ - regex: 'LGE LG\-AX([A-z0-9]+)'
661
+ device_replacement: 'LG $1'
662
+ - regex: 'LG\-([A-z0-9]+)'
663
+ device_replacement: 'LG $1'
664
+ - regex: 'LGE\-([A-z0-9]+)'
665
+ device_replacement: 'LG $1'
666
+ - regex: 'LG([A-z0-9]+)'
667
+ device_replacement: 'LG $1'
668
+
669
+ ##########
670
+ # kin
671
+ ##########
672
+ - regex: '(KIN)\.One (\d+)\.(\d+)'
673
+ device_replacement: 'Microsoft $1'
674
+ - regex: '(KIN)\.Two (\d+)\.(\d+)'
675
+ device_replacement: 'Microsoft $1'
676
+
677
+ ##########
678
+ # motorola
679
+ ##########
680
+ - regex: '(Motorola)\-([A-z0-9]+)'
681
+ - regex: 'MOTO\-([A-z0-9]+)'
682
+ device_replacement: 'Motorola $1'
683
+ - regex: 'MOT\-([A-z0-9]+)'
684
+ device_replacement: 'Motorola $1'
685
+
686
+ ##########
687
+ # philips
688
+ ##########
689
+ - regex: 'Philips([A-z0-9]+)'
690
+ device_replacement: 'Philips $1'
691
+ - regex: 'Philips ([A-z0-9]+)'
692
+ device_replacement: 'Philips $1'
693
+
694
+ ##########
695
+ # Samsung
696
+ ##########
697
+ - regex: 'SAMSUNG-([A-z0-9\-]+)'
698
+ device_replacement: 'Samsung $1'
699
+ - regex: 'SAMSUNG\; ([A-z0-9\-]+)'
700
+ device_replacement: 'Samsung $1'
701
+
702
+ ##########
703
+ # Softbank
704
+ ##########
705
+ - regex: 'Softbank/1\.0/([A-z0-9]+)'
706
+ device_replacement: 'Softbank $1'
707
+ - regex: 'Softbank/2\.0/([A-z0-9]+)'
708
+ device_replacement: 'Softbank $1'
709
+
710
+ ##########
711
+ # Generic Smart Phone
712
+ ##########
713
+ - regex: '(hiptop|avantgo|plucker|xiino|blazer|elaine|up.browser|up.link|mmp|smartphone|midp|wap|vodafone|o2|pocket|mobile|pda)'
714
+ device_replacement: "Generic Smartphone"
715
+
716
+ ##########
717
+ # Generic Feature Phone
718
+ ##########
719
+ - regex: '^(1207|3gso|4thp|501i|502i|503i|504i|505i|506i|6310|6590|770s|802s|a wa|acer|acs\-|airn|alav|asus|attw|au\-m|aur |aus |abac|acoo|aiko|alco|alca|amoi|anex|anny|anyw|aptu|arch|argo|bell|bird|bw\-n|bw\-u|beck|benq|bilb|blac|c55/|cdm\-|chtm|capi|comp|cond|craw|dall|dbte|dc\-s|dica|ds\-d|ds12|dait|devi|dmob|doco|dopo|el49|erk0|esl8|ez40|ez60|ez70|ezos|ezze|elai|emul|eric|ezwa|fake|fly\-|fly\_|g\-mo|g1 u|g560|gf\-5|grun|gene|go.w|good|grad|hcit|hd\-m|hd\-p|hd\-t|hei\-|hp i|hpip|hs\-c|htc |htc\-|htca|htcg)'
720
+ device_replacement: 'Generic Feature Phone'
721
+ - regex: '^(htcp|htcs|htct|htc\_|haie|hita|huaw|hutc|i\-20|i\-go|i\-ma|i230|iac|iac\-|iac/|ig01|im1k|inno|iris|jata|java|kddi|kgt|kgt/|kpt |kwc\-|klon|lexi|lg g|lg\-a|lg\-b|lg\-c|lg\-d|lg\-f|lg\-g|lg\-k|lg\-l|lg\-m|lg\-o|lg\-p|lg\-s|lg\-t|lg\-u|lg\-w|lg/k|lg/l|lg/u|lg50|lg54|lge\-|lge/|lynx|leno|m1\-w|m3ga|m50/|maui|mc01|mc21|mcca|medi|meri|mio8|mioa|mo01|mo02|mode|modo|mot |mot\-|mt50|mtp1|mtv |mate|maxo|merc|mits|mobi|motv|mozz|n100|n101|n102|n202|n203|n300|n302|n500|n502|n505|n700|n701|n710|nec\-|nem\-|newg|neon)'
722
+ device_replacement: 'Generic Feature Phone'
723
+ - regex: '^(netf|noki|nzph|o2 x|o2\-x|opwv|owg1|opti|oran|ot\-s|p800|pand|pg\-1|pg\-2|pg\-3|pg\-6|pg\-8|pg\-c|pg13|phil|pn\-2|pt\-g|palm|pana|pire|pock|pose|psio|qa\-a|qc\-2|qc\-3|qc\-5|qc\-7|qc07|qc12|qc21|qc32|qc60|qci\-|qwap|qtek|r380|r600|raks|rim9|rove|s55/|sage|sams|sc01|sch\-|scp\-|sdk/|se47|sec\-|sec0|sec1|semc|sgh\-|shar|sie\-|sk\-0|sl45|slid|smb3|smt5|sp01|sph\-|spv |spv\-|sy01|samm|sany|sava|scoo|send|siem|smar|smit|soft|sony|t\-mo|t218|t250|t600|t610|t618|tcl\-|tdg\-|telm|tim\-|ts70|tsm\-|tsm3|tsm5|tx\-9|tagt)'
724
+ device_replacement: 'Generic Feature Phone'
725
+ - regex: '^(talk|teli|topl|tosh|up.b|upg1|utst|v400|v750|veri|vk\-v|vk40|vk50|vk52|vk53|vm40|vx98|virg|vite|voda|vulc|w3c |w3c\-|wapj|wapp|wapu|wapm|wig |wapi|wapr|wapv|wapy|wapa|waps|wapt|winc|winw|wonu|x700|xda2|xdag|yas\-|your|zte\-|zeto|aste|audi|avan|blaz|brew|brvw|bumb|ccwa|cell|cldc|cmd\-|dang|eml2|fetc|hipt|http|ibro|idea|ikom|ipaq|jbro|jemu|jigs|keji|kyoc|kyok|libw|m\-cr|midp|mmef|moto|mwbp|mywa|newt|nok6|o2im|pant|pdxg|play|pluc|port|prox|rozo|sama|seri|smal|symb|treo|upsi|vx52|vx53|vx60|vx61|vx70|vx80|vx81|vx83|vx85|wap\-|webc|whit|wmlb|xda\-|xda\_)'
726
+ device_replacement: 'Generic Feature Phone'
727
+
728
+ ##########
729
+ # Spiders (this is hack...)
730
+ ##########
731
+ - regex: '(bot|borg|google(^tv)|yahoo|slurp|msnbot|msrbot|openbot|archiver|netresearch|lycos|scooter|altavista|teoma|gigabot|baiduspider|blitzbot|oegp|charlotte|furlbot|http%20client|polybot|htdig|ichiro|mogimogi|larbin|pompos|scrubby|searchsight|seekbot|semanticdiscovery|silk|snappy|speedy|spider|voila|vortex|voyager|zao|zeal|fast\-webcrawler|converacrawler|dataparksearch|findlinks)'
732
+ device_replacement: 'Spider'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_agent_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,11 +18,14 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - MIT-LICENSE
22
+ - Readme.md
21
23
  - lib/user_agent_parser.rb
22
24
  - lib/user_agent_parser/operating_system.rb
23
25
  - lib/user_agent_parser/parser.rb
24
26
  - lib/user_agent_parser/user_agent.rb
25
27
  - lib/user_agent_parser/version.rb
28
+ - vendor/ua-parser/regexes.yaml
26
29
  homepage: http://github.com/toolmantim/user_agent_parser
27
30
  licenses:
28
31
  - MIT
@@ -44,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
47
  version: '0'
45
48
  segments:
46
49
  - 0
47
- hash: 2720701220446018537
50
+ hash: 1405063737909332599
48
51
  requirements: []
49
52
  rubyforge_project:
50
53
  rubygems_version: 1.8.23