UA-Extract – Easy way to keep user-agent parsing updated

Simplify User-Agent Detection with UA-Extract: An Advanced Yet Easy-to-Update Python Solution

In the ever-evolving landscape of web development, accurately detecting user devices, browsers, and operating systems is crucial. If you’re a developer working with user-agent strings, you know how quickly they become outdated as new devices and browsers emerge. To address this challenge, Iโ€™m excited to introduce UA-Extract, a robust Python library designed to streamline user-agent parsing while ensuring your regex patterns stay current with minimal effort.


What is UA-Extract?

UA-Extract is a high-performance, easy-to-use Python toolkit aimed at reliably identifying user devices, operating systems, and browsers from their user-agent strings. Built upon the widely respected device_detector library, UA-Extract leverages a comprehensive, frequently updated database of regex patterns, which simplifies the process of decoding even the most obscure user agents.

The standout feature? Effortless updates of regex patterns. Instead of manually editing regexes or updating internal data, UA-Extract allows you to fetch the latest regexes with a single line of code or a straightforward command-line instruction, ensuring your detection remains accurate without tedious manual adjustments.


Key Features and Benefits

  • Automatic Regex Updates: Keep your detection logic fresh with minimal effort. Update regex patterns effortlessly through code or CLI:

python
from ua_extract import Regexes
Regexes().update_regexes() # Fetch latest patterns

Or via terminal:

ua_extract update_regexes

  • Rich Device Identification: Decode user-agent strings to obtain detailed information about devices, browsers, and operating systems, including mobile phones, tablets, smart TVs, and gaming consoles.

  • Flexible Parsing Options: Use different detector classes for tailored results:

“`python
from ua_extract import DeviceDetector

ua = ‘Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57 EtsyInc/5.22 rv:52200.62.0’
device_info = DeviceDetector(ua).parse()

print(device_info.os_name()) # e.g., iOS
print(device_info.device_model()) # e.g., iPhone
print(device_info.secondary_client_name()) # e.g., EtsyInc


Leave a Reply

Your email address will not be published. Required fields are marked *