Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 891df5e

Browse filesBrowse files
author
Nguyễn Hồng Quân
committed
Fix Nokia parsing
Nokia N9 (MeeGo) and N900 (Maemo)
1 parent 80bbacb commit 891df5e
Copy full SHA for 891df5e

File tree

Expand file treeCollapse file tree

2 files changed

+18
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+18
-2
lines changed

‎user_agents/devices.json

Copy file name to clipboardExpand all lines: user_agents/devices.json
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"is_mobile": true,
149149
"is_pc": false,
150150
"is_tablet": false,
151-
"is_touch_capable": false,
151+
"is_touch_capable": true,
152152
"ua_string": "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
153153
"str": "Nokia N9 / MeeGo / Nokia Browser 8.5.0"
154154
},
@@ -161,6 +161,15 @@
161161
"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",
162162
"str": "Nokia N97 / Symbian OS 9.4 / Nokia Browser 7.1.12344"
163163
},
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+
},
164173
"playbook": {
165174
"is_bot": false,
166175
"is_mobile": false,

‎user_agents/parsers.py

Copy file name to clipboardExpand all lines: user_agents/parsers.py
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
'iPod',
1919
'Generic Smartphone',
2020
'Generic Feature Phone',
21-
'Nokia N9',
2221
'PlayStation Vita',
2322
)
2423

@@ -36,6 +35,7 @@
3635
'Bada',
3736
'Windows CE',
3837
'Windows Mobile',
38+
'Maemo',
3939
)
4040

4141
MOBILE_BROWSER_FAMILIES = (
@@ -64,6 +64,7 @@
6464
'Windows CE',
6565
'Windows Mobile',
6666
'Firefox OS',
67+
'MeeGo',
6768
)
6869

6970
TOUCH_CAPABLE_DEVICE_FAMILIES = (
@@ -195,6 +196,9 @@ def is_mobile(self):
195196
# Mobile Spiders should be identified as mobile
196197
if self.device.family == 'Spider' and 'Mobile' in self.browser.family:
197198
return True
199+
# Nokia mobile
200+
if 'NokiaBrowser' in self.ua_string and 'Mobile' in self.ua_string:
201+
return True
198202
return False
199203

200204
@property
@@ -218,6 +222,9 @@ def is_pc(self):
218222
# TODO: remove after https://github.com/tobie/ua-parser/issues/127 is closed
219223
if self.os.family == 'Mac OS X' and 'Silk' not in self.ua_string:
220224
return True
225+
# Maemo has 'Linux' and 'X11' in UA, but it is not for PC
226+
if 'Maemo' in self.ua_string:
227+
return False
221228
if 'Linux' in self.ua_string and 'X11' in self.ua_string:
222229
return True
223230
return False

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.