findify / uap-scala

Scala port of ua-parser

Version Matrix

UA Parser Scala Library (findify fork)

This is the Scala implementation of ua-parser. The implementation uses the shared regex patterns and overrides from regexes.yaml. Maintained by findify, as the original author seems dead.

How to use with sbt:

Plug-and-play into your build.sbt:

resolvers += Resolver.jcenterRepo
libraryDependencies += "io.findify" %% "uap-scala" % "1.1.0"

Usage:

import ua.parser.Parser

  val ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3"
  val client = Parser.get.parse(ua) // you can also use CachingParser
  println(client) // Client(UserAgent(Mobile Safari,Some(5),Some(1),None),OS(iOS,Some(5),Some(1),Some(1),None),Device(iPhone))
}

Author:

Based on the java implementation by Steve Jiang @sjiang and using agent data from BrowserScope