Created
January 21, 2014 20:55
-
-
Save randyzwitch/8548195 to your computer and use it in GitHub Desktop.
Minimal examples of UAParser.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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