Skip to content

Commit 973e5f4

Browse files
committed
Merge pull request selwin#16 from solute/master
mobile spiders should be considered mobile
2 parents 503dcae + 6413624 commit 973e5f4

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎user_agents/devices.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@
249249
"is_touch_capable": true,
250250
"ua_string": "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)",
251251
"str": "PC / Windows RT / IE 10"
252+
},
253+
"googlebot_mobile": {
254+
"is_bot": true,
255+
"is_mobile": true,
256+
"is_pc": false,
257+
"is_tablet": false,
258+
"is_touch_capable": false,
259+
"ua_string": "Mozilla/5.0 (iPhone; U; CPU iPhone OS) (compatible; Googlebot-Mobile/2.1; http://www.google.com/bot.html)",
260+
"str": "Spider / Other / Mobile Safari"
252261
}
253262
}
254263

‎user_agents/parsers.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def is_mobile(self):
166166
# TODO: remove after https://github.com/tobie/ua-parser/issues/126 is closed
167167
if 'J2ME' in self.ua_string or 'MIDP' in self.ua_string:
168168
return True
169+
# Mobile Spiders should be identified as mobile
170+
if self.device.family == 'Spider' and 'Mobile' in self.browser.family:
171+
return True
169172
return False
170173

171174
@property

0 commit comments

Comments
 (0)