No description
Find a file
2021-09-30 17:32:10 -07:00
.github/workflows Add actions 2021-09-30 17:08:07 -07:00
build Working code 2018-02-24 10:27:24 -08:00
nimcache Working code 2018-02-24 10:27:24 -08:00
tests Fix tests 2021-09-30 17:32:10 -07:00
useragents Working code 2018-02-24 10:27:24 -08:00
.gitignore Working code 2018-02-24 10:27:24 -08:00
LICENSE First commit 2018-02-24 10:25:14 -08:00
README.md Update readme. 2021-09-30 16:56:48 -07:00
useragents.nim Update for nim 0.20.0. 2019-07-16 12:58:33 -07:00
useragents.nimble Update for nim 0.20.0. 2019-07-16 12:58:33 -07:00

Useragent parser for nim.

nimble install useragents

Github Actions

API reference

This library has no dependencies other than the Nim standard libarary.

About

Module provides just one function to parse a user agent:

import useragents
echo parseUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36")

UserAgent(
	browserName: "Chrome",
	browserMajorVersion: "61",
	browserMinorVersion: "0",
	browserPatchVersion: "3163",
	browserPatchMinorVersion: "",
	osName: "Mac OS X",
	osMajorVersion: "10",
	osMinorVersion: "12",
	osPatchVersion: "3",
	osPatchMinorVersion: "",
	deviceName: "Other",
	deviceBrand: "",
	deviceModel: ""
)

Provides 5,000 lines of regex and another 90,000 lines of tests to make sure event the most arcane user agents are parsed. Based on the work done by: https://github.com/ua-parser/uap-core