Skip to content
A port of ua-parser2 to Elixir. User agent parser library.
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
priv
test
.gitignore
.travis.yml
LICENSE
README.md
mix.exs
mix.lock

README.md

UAParser2

Build Status Hex pm

A port of ua-parser2 to Elixir

Installation

Add UAParser2 as a dependency to your project's mix.exs:

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

defp deps do
  [{:ua_parser2, github: "nazipov/ua_parser2-elixir"}]
end

and then run $ mix deps.get

Usage

iex(1)> UAParser2.parse("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0")
%UAParser2.Result{
  string: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0",
  device: nil,
  engine: %UAParser2.Result.Engine{
    family: "Gecko", 
    major: "47", 
    minor: "0",
    patch: nil, 
    type: nil
  },
  os: %UAParser2.Result.OS{
    family: "Mac OS X", 
    major: "10", 
    minor: "11",
    patch: nil, 
    patchMinor: nil, 
    type: nil
  },
  ua: %UAParser2.Result.UA{
    family: "Firefox", 
    major: "47", 
    minor: "0", 
    patch: nil, 
    type: nil
  }
}

License

Apache License, Version 2.0

The parser databases are taken from the commenthol/ua-parser2 project. See there for detailed license information about the data contained.

You can’t perform that action at this time.