package user-agent-parser

Not available on OCaml 5.5
  1. Overview
  2. Docs
OCaml implementation of the user agent parse rules of uap-core

Install

dune-project
 Dependency

Authors

Maintainers

Sources

user-agent-parser-0.2.0.tbz
sha256=00ca1fbb107a1628733dcd95277b9630e466d235a354c8f8055d491c3307e026
sha512=d8e3fa10ef6d95ea3d176aa0c5d43c5ab7f54ff5f8d7ae4f543a19221a79e554e65d1078e7663be6214af4a6b165620735639d8dec1fc8e70158455784ec039d

Description

OCaml implementation of the user agent parse rules from https://github.com/ua-parser/uap-core

Added to opam-repository:

README

user-agent-parser (ocaml)

Build Status

Ocaml implementation of the user agent parse rules from https://github.com/ua-parser/uap-core

Documentation: https://issuu.github.io/uap-ocaml/

Example

(* init compiles a bunch of regexes, so try to do this just once *)
let uaparser = User_agent_parser.init () in

let user_agent = "Mozilla/5.0 (Windows; Windows NT 5.1; rv:2.0b3pre) Gecko/20100727 Minefield/4.0.1pre" in
let parsed = User_agent_parser.parse uaparser user_agent in
Printf.printf "%s\n" parsed.ua.family;                     (* Firefox (Minefield) *)
Printf.printf "%s %s\n" parsed.os.family parsed.os.major;  (* Windows XP *)
Printf.printf "%s\n" parsed.device.family;                 (* Other *)

let user_agent = "Mozilla/5.0 (Linux; U; Android 4.2.2; de-de; PEDI_PLUS_W Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30" in
let parsed = User_agent_parser.parse uaparser user_agent in
Printf.printf "%s\n" parsed.ua.family;                     (* Android *)
Printf.printf "%s %s\n" parsed.os.family parsed.os.major;  (* Android 4 *)
Printf.printf "%s\n" parsed.device.family                  (* Odys PEDI PLUS W *)

License

Apache 2.0, see LICENSE.

Dependencies (9)

  1. yojson >= "1.6.0"
  2. yaml build & >= "0.2.1"
  3. re >= "1.8.0"
  4. stdio >= "v0.11"
  5. ppx_let
  6. ppx_deriving
  7. ocaml >= "4.05.0"
  8. dune >= "1.3"
  9. base >= "v0.11" & < "v0.17"

Dev Dependencies (2)

  1. yaml with-test & >= "2.0.0"
  2. alcotest with-test & >= "0.8.3"

Used by

None

Conflicts

None

Build status

Results of building user-agent-parser with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.2.0 (this version) good good good n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure