Skip to content

Instantly share code, notes, and snippets.

@randyzwitch
Created January 21, 2014 20:55
Show Gist options
  • Save randyzwitch/8548195 to your computer and use it in GitHub Desktop.
Save randyzwitch/8548195 to your computer and use it in GitHub Desktop.
Minimal examples of UAParser.jl
Pkg.add("UAParser")
using UAParser
#Example user-agent string
user_agent_string = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B179 Safari/7534.48.3"
#Get device from user-agent string
parsedevice(user_agent_string) #=> DeviceResult("iPhone")
#Get browser information from user-agent string
parseuseragent(user_agent_string) #=> UAResult("Mobile Safari","5","1",nothing)
#Get os information
parseos(user_agent_string) #=> OSResult("iOS","5","1",nothing,nothing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment