beam-community / ua_parser Goto Github PK
View Code? Open in Web Editor NEWUserAgentParser implementation for Elixir
License: Apache License 2.0
UserAgentParser implementation for Elixir
License: Apache License 2.0
The README has a broken link in it.
Title says it all ๐
Yesterday I encountered a behavior like as a title.
Situation: When sent a https request from my iPad app to my phoenix app that using ua_parser
UserAgent string is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)" |> UAParser.parse()
%UAParser.UA{
device: %UAParser.Device{brand: nil, family: nil, model: nil},
family: "Apple Mail",
os: %UAParser.OperatingSystem{
family: "Mac OS X",
version: %UAParser.Version{
major: "10",
minor: "15",
patch: nil,
patch_minor: nil
}
},
version: %UAParser.Version{
major: "605",
minor: "1",
patch: "15",
patch_minor: nil
}
}
The project has been renamed, and consistency is nice. This should be done as soon as we merge PR #1.
The following user agent is for IE 11 but parses as IE 10. In compatibility mode, the Trident version still corresponds to IE 11 (4 versions behind).
Mozilla/5.0 (compatible%3B MSIE 10.0%3B Windows NT 6.1%3B WOW64%3B Trident/7.0%3B)
And here is a short MS blog about IE 11 user agents. https://blogs.msdn.microsoft.com/ieinternals/2013/09/21/internet-explorer-11s-many-user-agent-strings/
I'll give this issue a try.
Hi again! I was testing parsing some different user agent strings, and I tried out a string for a Chromebook running Linux -
iex(1)> str = "Mozilla/5.0 (Linux; Android 7.1.1; Acer Chromebook R13 (CB5-312T) Build/R66-10452.85.0; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36"
iex(2)> str |> UAParser.parse()
%UAParser.UA{
device: %UAParser.Device{
brand: "Acer",
family: "Acer Chromebook R13 (CB5-312T)",
model: "Chromebook R13 (CB5-312T)"
},
family: "Chrome Mobile WebView",
os: %UAParser.OperatingSystem{
family: "Android",
version: %UAParser.Version{
major: "7",
minor: "1",
patch: "1",
patch_minor: nil
}
},
version: %UAParser.Version{
major: "56",
minor: "0",
patch: "2924",
patch_minor: "87"
}
}
Among other things, I expected that the os.family
would be "Linux"
, rather than "Android"
.
Unfortunately, I don't own a Chromebook with Linux, so I can only go by the sample user agent strings I found at http://www.webapps-online.com/online-tools/user-agent-strings/dv/brand642387/chromebook
What do y'all think about this? If you feel it's a legit issue, I'd be happy to pick it up and open a PR for it. Again, I can't verify the accuracy of the UA string, and this was the only example that I could find, so if you feel the source isn't reliable enough to warrant making any changes, I'd certainly understand.
Thanks for all of your hard work!
Hello, thank you so much for this extremely helpful library!
I noticed that the regex used for Chromium/Chrome fails to pick up the minor patch version - this isn't a big deal, but it'd be nice to have it. Correct me if I'm wrong, but I believe that the regex would need to be:
- regex: '(Chromium|Chrome)/(\d+)\.(\d+)(?:\.(\d+))(?:\.(\d+))?'
That's line 437 of patterns.yml. Otherwise, that value comes back as nil
.
What do you think?
Hi!
I need to detect if the user_agent
is mobile or not. I found this solution with regex for other languages, but I think it fits well here.
We can add a field kind
with options :desktop
, :mobile
, or nil
to the device.
I'm opening the issue to discuss the implementation, after that, I would like to implement this.
Thanks!
We've run across a handful of user agents that don't parse well, all of the following are missing the OS values:
One in particular is missing both OS and browser version:
Add typespecs t:t/0
for structs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.