user_agent_parser

A simple, comprehensive Elixir package for parsing user agent strings with the help of BrowserScope's UA database

Latest version: 1.0.1 registry icon
Maintenance score
0
Safety score
0
Popularity score
1
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
1.0.1 0 0 0 0 0
1.0.0 0 0 0 0 0

Stability
Latest release:

1.0.1 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



UserAgentParser

UserAgentParser is a simple Elixir package for parsing user agent strings. It uses BrowserScope's parsing patterns.

Installation

  1. Add user_agent_parser to your list of dependencies in mix.exs:

    def deps do [{:user_agent_parser, "~> 1.0"}] end

  2. Ensure user_agent_parser is started before your application:

    def application do [applications: [:user_agent_parser]] end

  3. Add worker(UA.Parser, []), to your supervisor tree

Usage example

iex(1)> user_agent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; Microsoft; Lumia 640 XL)"
iex(2)> UserAgentParser.detect_browser(user_agent)
%UA.Browser{family: "IE Mobile", version: "10.0"}
iex(2)> UserAgentParser.detect_os(user_agent)
%UA.OS{family: "Windows Phone", version: "8.0"}
iex(3)> UserAgentParser.detect_device(user_agent)
%UA.Device{brand: "Microsoft", model: "Lumia 640 XL", name: "Microsoft Lumia 640 XL"}
iex(4)> UserAgentParser.parse(user_agent)
{%UA.Browser{family: "IE Mobile", version: "10.0"},
 %UA.OS{family: "Windows Phone", version: "8.0"},
 %UA.Device{brand: "Microsoft", model: "Lumia 640 XL",
  name: "Microsoft Lumia 640 XL"}}