ua-parser / uap-core

The regex file necessary to build language ports of Browserscope's user agent parser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firefox Tablet/Mobile parsing fail for os

karlcow opened this issue · comments

This is probably fixed.
let's try.

pip install ua_parser
Collecting ua_parser
  Downloading https://files.pythonhosted.org/packages/9d/22/4d16b08db329fd440eed366d35e4dd7195c9babb4ecac5218f28081522a2/ua_parser-0.10.0-py2.py3-none-any.whl
Installing collected packages: ua-parser
Successfully installed ua-parser-0.10.0

Python 3.7.6 (default, Jan  8 2020, 13:42:34) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ua_parser import user_agent_parser
>>> ua = 'Mozilla/5.0 (Android 10; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'
>>> uadot = 'Mozilla/5.0 (Android 10.0; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'
>>> uadotdot = 'Mozilla/5.0 (Android 10.0.0; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'
>>> user_agent_parser.Parse(ua)
{'user_agent': {'family': 'Firefox Mobile', 'major': '74', 'minor': '0', 'patch': None}, 'os': {'family': 'Android', 'major': '10', 'minor': None, 'patch': None, 'patch_minor': None}, 'device': {'family': 'Generic Tablet', 'brand': 'Generic', 'model': 'Tablet'}, 'string': 'Mozilla/5.0 (Android 10; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'}
>>> user_agent_parser.Parse(uadot)
{'user_agent': {'family': 'Firefox Mobile', 'major': '74', 'minor': '0', 'patch': None}, 'os': {'family': 'Android', 'major': '10', 'minor': '0', 'patch': None, 'patch_minor': None}, 'device': {'family': 'Generic Tablet', 'brand': 'Generic', 'model': 'Tablet'}, 'string': 'Mozilla/5.0 (Android 10.0; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'}
>>> user_agent_parser.Parse(uadotdot)
{'user_agent': {'family': 'Firefox Mobile', 'major': '74', 'minor': '0', 'patch': None}, 'os': {'family': 'Android', 'major': '10', 'minor': '0', 'patch': '0', 'patch_minor': None}, 'device': {'family': 'Generic Tablet', 'brand': 'Generic', 'model': 'Tablet'}, 'string': 'Mozilla/5.0 (Android 10.0.0; Tablet; rv:74.0) Gecko/74.0 Firefox/74.0'}

This is fixed.