Comparing version 0.3.2 to 0.3.3
@@ -11,9 +11,10 @@ /* HEADER BEGIN */ | ||
var msiePattern = /MSIE ([.0-9]+);/; | ||
var tridentPattern = /Trident\/[.0-9]+; rv ([.0-9]+)/; | ||
var challengeMSIE = exports.challengeMSIE = function(ua, result) { | ||
if (ua.indexOf('compatible; MSIE') < 0) | ||
if (ua.indexOf('compatible; MSIE') < 0 && ua.indexOf('Trident/') < 0) | ||
return false; | ||
var version; | ||
var match = msiePattern.exec(ua); | ||
if (match) | ||
var match; | ||
if ((match = msiePattern.exec(ua)) || (match = tridentPattern.exec(ua))) | ||
version = match[1]; | ||
@@ -20,0 +21,0 @@ else |
@@ -36,3 +36,3 @@ var KEY_LABEL = exports.KEY_LABEL = 'label', | ||
// GENERATED from dataset.yaml at Fri Jun 7 19:04:57 JST 2013 by tagomoris | ||
// GENERATED from dataset.yaml at Mon Sep 2 19:53:25 JST 2013 by tagomoris | ||
var obj; | ||
@@ -60,2 +60,5 @@ obj = {label:'MSIE', name:'Internet Explorer', type:'browser'}; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8.1', name:'Windows 8.1', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8', name:'Windows 8', type:'os'}; | ||
@@ -62,0 +65,0 @@ obj['category'] = 'pc'; |
@@ -25,3 +25,4 @@ /* HEADER BEGIN */ | ||
var version = match[1]; | ||
if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
else if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
else if (version === 'NT 6.1') data = dataset.get('Win7'); | ||
@@ -28,0 +29,0 @@ else if (version === 'NT 6.0') data = dataset.get('WinVista'); |
{ | ||
"name": "woothee", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "User-Agent string parser (js implementation)", | ||
@@ -9,3 +9,4 @@ "main": "./release/woothee", | ||
"chai": ">= 1.3.0", | ||
"js-yaml": ">= 1.0.3" | ||
"js-yaml": ">= 1.0.3", | ||
"should": "~1.2.2" | ||
}, | ||
@@ -12,0 +13,0 @@ "scripts": { |
@@ -5,3 +5,3 @@ (function (){ | ||
// GENERATED at Thu Jun 6 17:29:07 JST 2013 by tagomoris | ||
// GENERATED at Mon Sep 2 20:00:02 JST 2013 by tagomoris | ||
var dataset = {}; | ||
@@ -46,3 +46,3 @@ (function(){ | ||
// GENERATED from dataset.yaml at Thu Jan 31 19:33:03 JST 2013 by tagomoris | ||
// GENERATED from dataset.yaml at Mon Sep 2 19:53:25 JST 2013 by tagomoris | ||
var obj; | ||
@@ -70,2 +70,5 @@ obj = {label:'MSIE', name:'Internet Explorer', type:'browser'}; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8.1', name:'Windows 8.1', type:'os'}; | ||
obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Win8', name:'Windows 8', type:'os'}; | ||
@@ -306,2 +309,6 @@ obj['category'] = 'pc'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'Genieo', name:'Genieo Web Filter', type:'full'}; | ||
obj['vendor'] = ''; | ||
obj['category'] = 'crawler'; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'topsyButterfly', name:'topsy Butterfly', type:'full'}; | ||
@@ -327,3 +334,3 @@ obj['vendor'] = ''; | ||
DATASET[obj.label] = obj; | ||
obj = {label:'gooIchiro', name:'goo', type:'full'}; | ||
obj = {label:'goo', name:'goo', type:'full'}; | ||
obj['vendor'] = ''; | ||
@@ -379,9 +386,10 @@ obj['category'] = 'crawler'; | ||
var msiePattern = /MSIE ([.0-9]+);/; | ||
var tridentPattern = /Trident\/[.0-9]+; rv ([.0-9]+)/; | ||
var challengeMSIE = exports.challengeMSIE = function(ua, result) { | ||
if (ua.indexOf('compatible; MSIE') < 0) | ||
if (ua.indexOf('compatible; MSIE') < 0 && ua.indexOf('Trident/') < 0) | ||
return false; | ||
var version; | ||
var match = msiePattern.exec(ua); | ||
if (match) | ||
var match; | ||
if ((match = msiePattern.exec(ua)) || (match = tridentPattern.exec(ua))) | ||
version = match[1]; | ||
@@ -499,3 +507,4 @@ else | ||
var version = match[1]; | ||
if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
if (version === 'NT 6.3') data = dataset.get('Win8.1'); | ||
else if (version === 'NT 6.2') data = dataset.get('Win8'); // "NT 6.2; ARM;" means Windows RT, oh.... | ||
else if (version === 'NT 6.1') data = dataset.get('Win7'); | ||
@@ -836,6 +845,10 @@ else if (version === 'NT 6.0') data = dataset.get('WinVista'); | ||
ua.indexOf('compatible; ichiro/mobile goo;') >= 0) { | ||
updateMap(result, dataset.get('gooIchiro')); | ||
updateMap(result, dataset.get('goo')); | ||
return true; | ||
} | ||
} | ||
if (ua.indexOf('gooblogsearch/') >= 0) { | ||
updateMap(result, dataset.get('goo')); | ||
return true; | ||
} | ||
if (ua.indexOf('Apple-PubSub') >= 0) { | ||
@@ -849,2 +862,6 @@ updateMap(result, dataset.get('ApplePubSub')); | ||
} | ||
if (ua.indexOf('Genieo/') >= 0) { | ||
updateMap(result, dataset.get('Genieo')); | ||
return true; | ||
} | ||
if (ua.indexOf('labs.topsy.com/butterfly/') >= 0) { | ||
@@ -891,3 +908,3 @@ updateMap(result, dataset.get('topsyButterfly')); | ||
var challengeMaybeCrawler = exports.challengeMaybeCrawler = function(ua, result) { | ||
if (/bot(?:[-_ .\/;@()]|$)/i.exec(ua)) { | ||
if (/(bot|crawler|spider)(?:[-_ .\/;@()]|$)/i.exec(ua)) { | ||
updateMap(result, dataset.get('VariousCrawler')); | ||
@@ -988,4 +1005,6 @@ return true; | ||
var data,version; | ||
if (/^(?:Apache-HttpClient\/|Jakarta Commons-HttpClient\/|Java\/)/.exec(ua)) { | ||
if (/^(?:Apache-HttpClient\/|Jakarta Commons-HttpClient\/|Java\/)/.exec(ua) || /[- ]HttpClient(\/|$)/.exec(ua)) { | ||
data = dataset.get('HTTPLibrary'); version = 'Java'; | ||
} else if (ua.indexOf('Java(TM) 2 Runtime Environment,') >= 0) { | ||
data = dataset.get('HTTPLibrary'); version = 'Java'; | ||
} else if (/^Wget/.exec(ua)) { | ||
@@ -995,5 +1014,7 @@ data = dataset.get('HTTPLibrary'); version = 'wget'; | ||
data = dataset.get('HTTPLibrary'); version = 'perl'; | ||
} else if (/^Python-urllib\//.exec(ua)) { | ||
} else if (/^(?:Ruby|feedzirra|Typhoeus)/.exec(ua)) { | ||
data = dataset.get('HTTPLibrary'); version = 'ruby'; | ||
} else if (/^(?:Python-urllib\/|Twisted )/.exec(ua)) { | ||
data = dataset.get('HTTPLibrary'); version = 'python'; | ||
} else if (/^(:?PHP\/|WordPress\/|CakePHP|PukiWiki\/)/.exec(ua)) { | ||
} else if (/^(:?PHP|WordPress|CakePHP|PukiWiki|PECL::HTTP)(?:\/| |$)/.exec(ua) || /(?:PEAR |)HTTP_Request(?: class|2)/.exec(ua)) { | ||
data = dataset.get('HTTPLibrary'); version = 'php'; | ||
@@ -1014,3 +1035,9 @@ } else if (ua.indexOf('PEAR HTTP_Request class;') >= 0) { | ||
var data = null; | ||
if (/rss(?:reader|bar|[-_ \/;()])/i.exec(ua)) data = dataset.get('VariousRSSReader'); | ||
if (/rss(?:reader|bar|[-_ \/;()]|[ +]*\/)/i.exec(ua) || /headline-reader/i.exec(ua)) { | ||
data = dataset.get('VariousRSSReader'); | ||
} | ||
else { | ||
if (ua.indexOf('cococ/') >= 0) | ||
data = dataset.get('VariousRSSReader'); | ||
} | ||
@@ -1017,0 +1044,0 @@ if (! data) |
85074
2285
4