{"id":20492051,"url":"https://github.com/zotonic/ua_classifier","last_synced_at":"2025-04-13T17:01:33.650Z","repository":{"id":2928810,"uuid":"3940031","full_name":"zotonic/ua_classifier","owner":"zotonic","description":"User-Agent Classifier: Erlang version of WeatherChannel's dClass","archived":false,"fork":false,"pushed_at":"2019-11-19T09:01:42.000Z","size":630,"stargazers_count":5,"open_issues_count":0,"forks_count":8,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-27T07:51:33.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zotonic.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-05T13:37:48.000Z","updated_at":"2024-05-04T22:18:37.000Z","dependencies_parsed_at":"2022-09-18T01:00:45.874Z","dependency_job_id":null,"html_url":"https://github.com/zotonic/ua_classifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fua_classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fua_classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fua_classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zotonic%2Fua_classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zotonic","download_url":"https://codeload.github.com/zotonic/ua_classifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750077,"owners_count":21155685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T17:27:24.766Z","updated_at":"2025-04-13T17:01:33.620Z","avatar_url":"https://github.com/zotonic.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"User-Agent classification using TheWeatherChannel's dClass and OpenDDR\n======================================================================\n\nAn implementation of the user agent classification library [dClass by TheWeatherChannel](https://github.com/TheWeatherChannel/dClass) using an Erlang NIF.\n\n## Device Classification\n\nThe main interface is `ua_classifier:classify/1`.  It returns a property list with user agent properties from OpenDDR.\n\n```erlang\n{ok, Ps} = ua_classifier:classify(\"Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\").\n```\n\nReturns:\n\n```erlang\n{ok,[{is_wireless_device,true},\n     {is_tablet,false},\n     {ajax_support_javascript,true},\n     {device_os,\u003c\u003c\"iPhone OS\"\u003e\u003e},\n     {displayWidth,320},\n     {displayHeight,480},\n     {inputDevices,\u003c\u003c\"touchscreen\"\u003e\u003e},\n     {parentId,\u003c\u003c\"genericApple\"\u003e\u003e},\n     {model,\u003c\u003c\"iPod Touch\"\u003e\u003e},\n     {vendor,\u003c\u003c\"Apple\"\u003e\u003e},\n     {id, \u003c\u003c\"iPod\"\u003e\u003e]}\n```\n\nThis property list can be mapped to a device type with `ua_classifier:device_type/1`.\nKnown device types are: `text`, `phone`, `tablet` and `desktop`.\n\n```erlang\nua_classifier:device_type(Ps).\n```\n\nReturns:\n\n```erlang\nphone\n```\n\n## Browser Classification\n\nAnother interface is `ua_classifier:browser_classify/1`. Instead of returning the device classification of the \nuser-agent it returns the browser classification.\n\n```erlang\nua_classifier:browser_classify(\"Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7\").\n```\n\nReturns:\n\n```erlang\n{ok, [{os, \u003c\u003c\"iOS\"\u003e\u003e},\n      {browser, \u003c\u003c\"Safari\"\u003e\u003e},\n      {version, 4050},\n      {id, \u003c\u003c\"iossafari405\"\u003e\u003e}\n]}\n```\n\n\nThe OpenDDR data files\n----------------------\n\nThis library uses the \".dtree\" file of dClass. They are placed in `priv/openddr.dtree` and `priv/browser.dtree`.\nThe dtree files are loaded when the NIF is initialized and when the NIF is upgraded.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotonic%2Fua_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzotonic%2Fua_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzotonic%2Fua_classifier/lists"}