Skip to content

Commit 8fd709c

Browse files
committed
Merge pull request selwin#49 from hongquan/master
Support Nokia N9
2 parents 1bbd4c0 + 891df5e commit 8fd709c

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

user_agents/devices.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@
143143
"ua_string": "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",
144144
"str": "Nexus 7 / Android 4.1.1 / Chrome 18.0.1025"
145145
},
146+
"nokia_n9": {
147+
"is_bot": false,
148+
"is_mobile": true,
149+
"is_pc": false,
150+
"is_tablet": false,
151+
"is_touch_capable": true,
152+
"ua_string": "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
153+
"str": "Nokia N9 / MeeGo / Nokia Browser 8.5.0"
154+
},
146155
"nokia_n97": {
147156
"is_bot": false,
148157
"is_mobile": true,
@@ -152,6 +161,15 @@
152161
"ua_string": "Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/12.0.024; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.12344",
153162
"str": "Nokia N97 / Symbian OS 9.4 / Nokia Browser 7.1.12344"
154163
},
164+
"nokia_n900": {
165+
"is_bot": false,
166+
"is_mobile": true,
167+
"is_pc": false,
168+
"is_tablet": false,
169+
"is_touch_capable": false,
170+
"ua_string": "Mozilla/5.0 (X11; U; Linux armv7l; no-NO; rv:1.9.2.3pre) Gecko/20100723 Firefox/3.5 Maemo Browser 1.7.4.8 RX-51 N900",
171+
"str": "Nokia N900 / Maemo / Maemo Browser 1.7.4"
172+
},
155173
"playbook": {
156174
"is_bot": false,
157175
"is_mobile": false,

user_agents/parsers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
'Bada',
3636
'Windows CE',
3737
'Windows Mobile',
38+
'Maemo',
3839
)
3940

4041
MOBILE_BROWSER_FAMILIES = (
@@ -63,6 +64,7 @@
6364
'Windows CE',
6465
'Windows Mobile',
6566
'Firefox OS',
67+
'MeeGo',
6668
)
6769

6870
TOUCH_CAPABLE_DEVICE_FAMILIES = (
@@ -196,6 +198,9 @@ def is_mobile(self):
196198
# Mobile Spiders should be identified as mobile
197199
if self.device.family == 'Spider' and 'Mobile' in self.browser.family:
198200
return True
201+
# Nokia mobile
202+
if 'NokiaBrowser' in self.ua_string and 'Mobile' in self.ua_string:
203+
return True
199204
return False
200205

201206
@property
@@ -219,6 +224,9 @@ def is_pc(self):
219224
# TODO: remove after https://github.com/tobie/ua-parser/issues/127 is closed
220225
if self.os.family == 'Mac OS X' and 'Silk' not in self.ua_string:
221226
return True
227+
# Maemo has 'Linux' and 'X11' in UA, but it is not for PC
228+
if 'Maemo' in self.ua_string:
229+
return False
222230
if 'Linux' in self.ua_string and 'X11' in self.ua_string:
223231
return True
224232
return False

0 commit comments

Comments
 (0)