python-user-agents icon indicating copy to clipboard operation
python-user-agents copied to clipboard

Samsung GT-P3113 and SM-T110 is identified as Generic

Open gitclem opened this issue 9 years ago • 1 comments

I'm guessing that these two regex in regexes.yaml should have worked but don't appear to do so.

  - regex: '; *(SAMSUNG-)?(GT\-[BINPS]\d{4}[^\/]*)(\/[^ ]*) Build'

  - regex: '; *((?:SCH|SGH|SHV|SHW|SPH|SC|SM)\-[A-Za-z0-9 ]+)(/?[^ ]*)? Build'

These are the failing cases:

>>> ua_string = "Mozilla/5.0 Linux U Android 4.2.2 es-us GT-P3113 Build/JDQ39 AppleWebKit/534.30 KHTML like Gecko Version/4.0 Safari/534.30"
>>> parsed_string = user_agent_parser.Parse(ua_string)
>>> pp.pprint(parsed_string)
{   'device': {   'brand': 'Generic',
                  'family': 'Generic Smartphone',
                  'model': 'Smartphone'},
    'os': {   'family': 'Android',
              'major': '4',
              'minor': '2',
              'patch': '2',
              'patch_minor': None},
    'string': 'Mozilla/5.0 Linux U Android 4.2.2 es-us GT-P3113 Build/JDQ39 AppleWebKit/534.30 KHTML like Gecko Version/4.0 Safari/534.30',
    'user_agent': {   'family': 'Android',
                      'major': '4',
                      'minor': '2',
                      'patch': '2'}}

>>> ua_string = "Mozilla/5.0 Linux Android 4.2.2 SM-T110 Build/JDQ39 AppleWebKit/537.36 KHTML like Gecko Chrome/49.0.2623.91 Safari/537.36"
>>> parsed_string = user_agent_parser.Parse(ua_string)
>>> pp.pprint(parsed_string)
{   'device': {   'brand': 'Generic',
                  'family': 'Generic Smartphone',
                  'model': 'Smartphone'},
    'os': {   'family': 'Android',
              'major': '4',
              'minor': '2',
              'patch': '2',
              'patch_minor': None},
    'string': 'Mozilla/5.0 Linux Android 4.2.2 SM-T110 Build/JDQ39 AppleWebKit/537.36 KHTML like Gecko Chrome/49.0.2623.91 Safari/537.36',
    'user_agent': {   'family': 'Chrome',
                      'major': '49',
                      'minor': '0',
                      'patch': '2623'}}

gitclem avatar Nov 23 '16 19:11 gitclem

it is more likely a upstream issue, please report to https://github.com/ua-parser/uap-core

jnozsc avatar Feb 08 '20 04:02 jnozsc