51Degrees / Device-Detection

THE Fastest and most Accurate device detection for C / PHP / Perl / Python and Node.js - professionally maintained device data
https://51degrees.com/device-detection
Other
112 stars 46 forks source link

unexpected matched with HashTrieV​34 #42

Closed PavMel closed 4 years ago

PavMel commented 4 years ago

RESULT:

provider_trie: Facebook for Android  <== wrong
provider_32: Chrome Mobile <== as expected

DB:

11/6/2019 | Premium | HashTrieV​34 | 40.76MB | 671f20632d15a9e702e00c5219fd1385

CODE:

import os
ABSPATH = os.path.dirname(__file__)

def match_ua_trie(ua):
    from FiftyOneDegrees import fiftyone_degrees_mobile_detector_v3_trie_wrapper
    from fiftyone_degrees.mobile_detector.conf import settings

    provider_trie = fiftyone_degrees_mobile_detector_v3_trie_wrapper.Provider(
        os.path.join(ABSPATH, 'data', '51degrees', '51Degrees-PremiumV3.4.trie'),
        settings.PROPERTIES,
    )

    device_object = provider_trie.getMatch(ua)
    print("provider_trie: %s" % device_object.getValue('BrowserName'))

def match_ua_32(ua):
    from FiftyOneDegrees import fiftyone_degrees_mobile_detector_v3_wrapper
    from fiftyone_degrees.mobile_detector.conf import settings
    dataFile = os.path.join(ABSPATH, 'data', '51degrees', '51Degrees-PremiumV3_2.dat')
    properties = settings.PROPERTIES
    cacheSize = settings.CACHE_SIZE
    poolSize = settings.POOL_SIZE
    provider32 = fiftyone_degrees_mobile_detector_v3_wrapper.Provider(
        dataFile,
        properties,
        cacheSize,
        poolSize
    )

    device_object = provider32.getMatch(ua)
    print("provider_32: %s" % device_object.getValue('BrowserName'))

if __name__ == '__main__':
    ua = 'Mozilla/5.0 (Linux; Android 9; Redmi Note 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.96 Mobile Safari/537.36'
    match_ua_trie(ua)
    match_ua_32(ua)
Steve51D commented 4 years ago

Thanks @PavMel. That's certainly an incorrect result! We'll investigate this and get back to you when we know more.

JoshGrew51D commented 4 years ago

I've just tested this with the latest version of our Premium Hash file and can confirm that the Browser is returning 'Chrome Mobile' as expected.

Please let me know if you are still experiencing the issue after updating.

PavMel commented 4 years ago

I've just tested this with the latest version of our Premium Hash file and can confirm that the Browser is returning 'Chrome Mobile' as expected.

Please let me know if you are still experiencing the issue after updating.

Confirmed.

Please also have a look user agents:

Mozilla/5.0 (Linux; U; Android 8.0.0; ar-SA; SM-J400M Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.13.4.1214 Mobile Safari/537.36 
Mozilla/5.0 (Linux; U; Android 5.1.1; en-US; Tv Box Build/VQ-V3) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.10.0.1163 UCTurbo/1.7.9.900 Mobile Safari/537.36    
JoshGrew51D commented 4 years ago

I've taken a look and we don't have these User-Agents in the database. I have sent them over to our data team to review and import.