update parse_useragent

This commit is contained in:
rolux 2012-10-27 18:51:39 +02:00
parent 71b99c8ce9
commit 48240cee7f

View file

@ -42,7 +42,8 @@ SUFFIXES = ['ii', 'iii', 'jr', 'jr.', 'ph.d.', 'phd', 'sr', 'sr.']
UA_ALIASES = { UA_ALIASES = {
'browser': { 'browser': {
'Chrome': '(CrMo)', 'Chrome': '(CrMo)',
'Firefox': '(Fennec|Firebird|Iceweasel|Minefield|Namoroka|Phoenix|SeaMonkey|Shiretoko)' 'Firefox': '(Fennec|Firebird|Iceweasel|Minefield|Namoroka|Phoenix|SeaMonkey|Shiretoko)',
'Nokia Browser': '(OviBrowser)'
}, },
'robot': {}, 'robot': {},
'system': { 'system': {
@ -54,18 +55,24 @@ UA_ALIASES = {
UA_NAMES = { UA_NAMES = {
'browser': { 'browser': {
'chromeframe': 'Chrome Frame', 'chromeframe': 'Chrome Frame',
'FBForIPhone': 'WebKit',
'Gecko': 'Mozilla', 'Gecko': 'Mozilla',
'Mozilla': 'Netscape', 'Mozilla': 'Netscape',
'MSIE': 'Internet Explorer' 'MSIE': 'Internet Explorer',
'NokiaBrowser': 'Nokia Browser'
}, },
'robot': {}, 'robot': {},
'system': { 'system': {
'CPU OS': 'iOS', 'CPU OS': 'iOS',
'iPhone': 'iOS', 'iPhone': 'iOS',
'iPhone OS': 'iOS', 'iPhone OS': 'iOS',
'J2ME/MIDP': 'Java',
'Mac_PowerPC': 'Mac OS', 'Mac_PowerPC': 'Mac OS',
'Mac_PPC': 'Mac OS', 'Mac_PPC': 'Mac OS',
'Macintosh': 'Mac OS', 'Macintosh': 'Mac OS',
'PLAYSTATION': 'PlayStation',
'S': 'Nokia',
'Series': 'Nokia',
'Win': 'Windows', 'Win': 'Windows',
'X11': 'Linux' 'X11': 'Linux'
} }
@ -77,6 +84,7 @@ UA_REGEXPS = {
'(chromeframe)\/(\d+)', '(chromeframe)\/(\d+)',
'(Chrome)\/(\d+)', '(Chrome)\/(\d+)',
'(Epiphany)\/(\d+)', '(Epiphany)\/(\d+)',
'(FBForIPhone)',
'(Firefox)\/(\d+)', '(Firefox)\/(\d+)',
'(Galeon)\/(\d+)', '(Galeon)\/(\d+)',
'(iCab) (\d+)', '(iCab) (\d+)',
@ -87,9 +95,10 @@ UA_REGEXPS = {
'(NokiaBrowser)\/(\d+)', '(NokiaBrowser)\/(\d+)',
'(OmniWeb)\/(\d+)', '(OmniWeb)\/(\d+)',
'(Opera)\/.+Version\/(\d+)', '(Opera)\/.+Version\/(\d+)',
'(OviBrowser)\/(\d+)',
'Version\/(\d+).+(Safari)', 'Version\/(\d+).+(Safari)',
'(WebKit)\/(\d+)', '(WebKit)\/(\d+)',
'(MSIE) (\d+)', # last, since Opera used to mask as MSIE '(MSIE) (\d\d?(?!\d))', # last, since Opera used to mask as MSIE
'(Gecko)', '(Gecko)',
'(Mozilla)\/(3|4)' '(Mozilla)\/(3|4)'
], ],
@ -97,10 +106,12 @@ UA_REGEXPS = {
'(BingPreview)\/(\d+)', '(BingPreview)\/(\d+)',
'(Google Web Preview).+Chrome\/(\d+)', '(Google Web Preview).+Chrome\/(\d+)',
'(Googlebot)\/(\d+)', '(Googlebot)\/(\d+)',
'(WebCrawler)\/(\d+)' '(WebCrawler)\/(\d+)',
'(Yahoo! Slurp)\/(\d+)'
], ],
'system': [ 'system': [
'(Android) (\d+)', '(Android) (\d+)',
'(Android)',
'(BeOS)', '(BeOS)',
'(BlackBerry) (\d+)', '(BlackBerry) (\d+)',
'(BlackBerry)', '(BlackBerry)',
@ -109,6 +120,7 @@ UA_REGEXPS = {
'(CPU OS) (\d+)', '(CPU OS) (\d+)',
'(iPhone OS) (\d+)', '(iPhone OS) (\d+)',
'(iPhone)', # Opera '(iPhone)', # Opera
'(J2ME\/MIDP)',
'(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)', '(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)',
'(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS).+(Linux)', '(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS).+(Linux)',
'(Linux)', '(Linux)',
@ -117,6 +129,9 @@ UA_REGEXPS = {
'(Mac_PowerPC)', '(Mac_PowerPC)',
'(Mac_PPC)', '(Mac_PPC)',
'(Macintosh)', '(Macintosh)',
'(PLAYSTATION) (\d+)',
'(S)(60);',
'(Series) ?(40|60)',
'(Symbian OS)', '(Symbian OS)',
'(SymbianOS)\/(\d+)', '(SymbianOS)\/(\d+)',
'(SymbOS)', '(SymbOS)',
@ -124,6 +139,7 @@ UA_REGEXPS = {
'(Unix) (AIX|HP-UX|IRIX|SunOS)', '(Unix) (AIX|HP-UX|IRIX|SunOS)',
'(Unix)', '(Unix)',
'(Windows) (NT \d\.\d)', '(Windows) (NT \d\.\d)',
'(Windows) (Phone OS)',
'(Windows) (3\.1|95|98|2000|2003|CE|ME|Mobile|NT|XP)', # Opera '(Windows) (3\.1|95|98|2000|2003|CE|ME|Mobile|NT|XP)', # Opera
'(Win) (9x 4\.90)', # Firefox '(Win) (9x 4\.90)', # Firefox
'(Win)(16)', # Firefox '(Win)(16)', # Firefox
@ -146,7 +162,8 @@ UA_VERSIONS = {
'10.6': '10.6 (Snow Leopard)', '10.6': '10.6 (Snow Leopard)',
'10.7': '10.7 (Lion)', '10.7': '10.7 (Lion)',
'10.8': '10.8 (Mountain Lion)', '10.8': '10.8 (Mountain Lion)',
'CrOS': 'Chrome OS', '40': 'Series 40',
'60': 'Series 60',
'NT 3.1': 'NT 3.1 (3.1)', 'NT 3.1': 'NT 3.1 (3.1)',
'NT 3.5': 'NT 3.5 (NT)', 'NT 3.5': 'NT 3.5 (NT)',
'NT 4.0': 'NT 4.0 (NT)', 'NT 4.0': 'NT 4.0 (NT)',