- Notifications
You must be signed in to change notification settings - Fork0
A simple user-agent parsing library based on BrowserScope's UA database.
License
channelme/uaparserl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple user-agent parsing library based onBrowserScope's UA database.
uaparserl
is tested with OTP from version 20 onwards. To use it, adduaparserl
to your dependencies:
{deps,[ {uaparserl, {git,"https://github.com/channelme/uaparserl.git"}}]}.
defprojectdo[deps:[{:uaparserl,git:"https://github.com/channelme/uaparserl.git"}]]end
If you want to use a HiPE compiled version, add following code to yourrebar.config
.
{overrides, [ {override, uaparserl, [{erl_opts, [{d, 'ENABLE_HIPE'}, inline]}]}]}.
Please note that this library returns captures "as is"; it is theresponsibility of the developer to ensure that results are properlyescaped when used in potentially harmful scenarios.
Also be aware that this library expects and returns strings. You mayneed to convert the return value to for correct use within your system.
%% Obtain the resource files from BrowserScope's github repository>uaparserl:update().ok%% Parse>uaparserl:parse("Luminary/70 CFNetwork/978.0.7 Darwin/18.5.0").[{useragent,[{family,"Luminary"}, {major,"70"}, {minor,nil}, {patch,nil}]}, {os,[{family,"iOS"}, {major,"12"}, {minor,nil}, {patch,nil}, {patch_minor,nil}]}, {device,[{family,"iOS-Device"}, {brand,"Apple"}, {model,"iOS-Device"}]}]
We welcome pull requests!
For local development, OTP21 or greater is required. Callmake
withinthe project directory for a list of commands that can be used to aidyour development process.
Copyright 2020 Channel.me B.V.Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.