### Check for HbbTV and Get Version Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Identifies if a user agent is HbbTV and, if so, returns its version. The function accepts a user agent string or related data, along with optional client hints. It returns either false or the HbbTV version string. ```Elixir hbbtv?(ua, client_hints \ nil) ``` @spec hbbtv?( UAInspector.Result.t() | UAInspector.Result.Bot.t() | String.t() | nil, UAInspector.ClientHints.t() | nil ) :: false | String.t() ``` ``` -------------------------------- ### System Status and Reload Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Checks the readiness of the UAInspector and provides functionality to reload its databases. ```APIDOC ## GET /ua/ready ### Description Checks if UAInspector is ready to perform lookups. The readiness is determined by the presence of data in its databases. ### Method GET ### Endpoint `/ua/ready` ### Response #### Success Response (200) - **is_ready** (boolean) - True if UAInspector is ready, false otherwise. #### Response Example ```json { "is_ready": true } ``` ``` ```APIDOC ## POST /ua/reload ### Description Reloads all databases used by UAInspector. This operation can be performed synchronously or asynchronously. ### Method POST ### Endpoint `/ua/reload` ### Request Body - **async** (boolean) - Optional - If true (default), the reload happens in the background. If false, the request will block until the reload is complete. ### Request Example ```json { "async": false } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the result of the reload operation (e.g., 'reloaded', 'in_progress'). #### Response Example ```json { "status": "reloaded" } ``` ``` -------------------------------- ### User Agent Lookup with Client Hints using UAInspector Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Parses a user agent string while also considering provided client hints for more accurate results. This can influence the detected browser, device, and OS information. ```elixir iex> client_hints = UAInspector.ClientHints.new([ ...> {"sec-ch-ua", ~S(" Not A;Brand";v=\"99\", \"Chromium\";v=\"95\", \"Microsoft Edge\";v=\"95\")}, ...> {"sec-ch-ua-mobile", "?0"}, ...> {"sec-ch-ua-platform", "Windows"}, ...> {"sec-ch-ua-platform-version", "14.0.0"} ...> ]) iex> UAInspector.parse("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.44", client_hints) %UAInspector.Result{ browser_family: "Internet Explorer", client: %UAInspector.Result.Client{ engine: "Blink", engine_version: "95.0.4638.69", name: "Microsoft Edge", type: "browser", version: "95.0.1020.44" }, device: %UAInspector.Result.Device{ brand: :unknown, model: :unknown, type: "desktop" }, os: %UAInspector.Result.OS{ name: "Windows", platform: "x64", version: "10" }, os_family: "Windows", user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.44" } iex> client_hints = UAInspector.ClientHints.new([{"x-requested-with", "org.telegram.messenger"}]) iex> UAInspector.parse("Mozilla/5.0 (Linux; Android 11; Pixel 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36", client_hints) %UAInspector.Result{ browser_family: :unknown, client: %UAInspector.Result.Client{ engine: :unknown, engine_version: :unknown, name: "Telegram", type: "mobile app", version: :unknown }, device: %UAInspector.Result.Device{ brand: "Google", model: "Pixel 3", type: "smartphone" }, os: %UAInspector.Result.OS{ name: "Android", platform: :unknown, version: "11" }, os_family: "Android", user_agent: "Mozilla/5.0 (Linux; Android 11; Pixel 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36" } ``` -------------------------------- ### Check UAInspector Readiness Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Checks if the UAInspector library is ready to perform lookups. This is determined by verifying the presence of data in all internal databases. It returns a boolean indicating readiness. ```Elixir ready?() ``` @spec ready?() :: boolean() ``` ``` -------------------------------- ### Basic User Agent Lookup with UAInspector Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Performs a basic lookup of a user agent string to parse device, OS, and browser information. Assumes 'desktop' if device type is indeterminate and returns 'unknown' for brand and model. ```elixir iex> UAInspector.parse("Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53") %UAInspector.Result{ browser_family: "Safari", client: %UAInspector.Result.Client{ engine: "WebKit", engine_version: "537.51.1", name: "Mobile Safari", type: "browser", version: "7.0" }, device: %UAInspector.Result.Device{ brand: "Apple", model: "iPad", type: "tablet" }, os: %UAInspector.Result.OS{ name: "iOS", platform: :unknown, version: "7.0.4" }, os_family: "iOS", user_agent: "Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53" } ``` -------------------------------- ### User Agent Parsing Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Parses a user agent string to extract detailed information. ```APIDOC ## POST /ua/parse ### Description Parses a user agent string to extract detailed information, including bot status. ### Method POST ### Endpoint `/ua/parse` ### Request Body - **ua** (string) - Required - The user agent string to parse. - **client_hints** (object) - Optional - Client hints object for more accurate parsing. ### Request Example ```json { "ua": "Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36" } ``` ### Response #### Success Response (200) - **parsed_ua** (object) - An object containing detailed parsed user agent information. #### Response Example ```json { "parsed_ua": { "browser": { "name": "Chrome", "version": "83.0.4103.106" }, "os": { "name": "Android", "version": "10" }, "device": { "name": "SM-G975F", "brand": "Samsung", "type": "mobile" }, "is_bot": false } } ``` ``` ```APIDOC ## POST /ua/parse_client ### Description Parses a user agent string without checking for bots. ### Method POST ### Endpoint `/ua/parse_client` ### Request Body - **ua** (string) - Required - The user agent string to parse. - **client_hints** (object) - Optional - Client hints object for more accurate parsing. ### Request Example ```json { "ua": "Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36" } ``` ### Response #### Success Response (200) - **parsed_ua** (object) - An object containing detailed parsed user agent information (excluding bot status). #### Response Example ```json { "parsed_ua": { "browser": { "name": "Chrome", "version": "83.0.4103.106" }, "os": { "name": "Android", "version": "10" }, "device": { "name": "SM-G975F", "brand": "Samsung", "type": "mobile" } } } ``` ``` -------------------------------- ### Device Type Detection Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Determines if a user agent corresponds to a desktop, mobile, or ShellTV device. ```APIDOC ## GET /ua/device_type ### Description Checks if a user agent is a desktop, mobile, or ShellTV device. ### Method GET ### Endpoint `/ua/device_type` ### Query Parameters - **ua** (string) - Required - The user agent string to check. - **client_hints** (object) - Optional - Client hints object for more accurate detection. ### Response #### Success Response (200) - **device_type** (string) - The type of device (e.g., 'desktop', 'mobile', 'shelttv'). #### Response Example ```json { "device_type": "mobile" } ``` ``` -------------------------------- ### Check if User Agent is a Desktop Device Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Verifies if a user agent string represents a desktop device. This function takes a user agent string or related data structure and optional client hints, returning a boolean. ```Elixir desktop?(ua, client_hints \ nil) ``` @spec desktop?( UAInspector.Result.t() | UAInspector.Result.Bot.t() | String.t() | nil, UAInspector.ClientHints.t() | nil ) :: boolean() ``` ``` -------------------------------- ### Parse User Agent String Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Parses a user agent string to extract detailed information. It can optionally use client hints for more accurate results. The function returns a parsed result object, which could be a standard result or a bot-specific result. ```Elixir parse(ua, client_hints \ nil) ``` @spec parse(String.t() | nil, UAInspector.ClientHints.t() | nil) :: UAInspector.Result.t() | UAInspector.Result.Bot.t() ``` ``` -------------------------------- ### Reload UAInspector Databases Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Reloads all internal databases used by UAInspector. This function can be called with an option to perform the reload asynchronously (default) or synchronously. It returns :ok upon successful initiation of the reload. ```Elixir reload(opts \ [async: true]) ``` @spec reload(Keyword.t()) :: :ok ``` ``` -------------------------------- ### Bot User Agent Lookup with UAInspector Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Identifies and parses user agent strings that belong to bots. Returns a `UAInspector.Result.Bot` struct with details about the bot's category, name, producer, and URL. ```elixir iex> UAInspector.parse("Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36") %UAInspector.Result.Bot{ category: "Search bot", name: "Googlebot", producer: %UAInspector.Result.BotProducer{ name: "Google Inc.", url: "http://www.google.com" }, url: "http://www.google.com/bot.html", user_agent: "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36" } iex> UAInspector.parse("generic crawler agent") %UAInspector.Result.Bot{ category: :unknown, name: "Generic Bot", producer: %UAInspector.Result.BotProducer{ name: :unknown, url: :unknown }, url: :unknown, user_agent: "generic crawler agent" } ``` -------------------------------- ### HbbTV Detection Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Checks if a user agent is HbbTV and returns its version if applicable. ```APIDOC ## GET /ua/hbbtv_version ### Description Checks if a user agent is a HbbTV and returns its version if so. ### Method GET ### Endpoint `/ua/hbbtv_version` ### Query Parameters - **ua** (string) - Required - The user agent string to check. - **client_hints** (object) - Optional - Client hints object for more accurate detection. ### Response #### Success Response (200) - **hbbtv_version** (string | null) - The HbbTV version if detected, otherwise null. #### Response Example ```json { "hbbtv_version": "1.5.1" } ``` ``` -------------------------------- ### Check if User Agent is ShellTV Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Determines if a user agent string identifies a ShellTV device. The function takes the user agent string and optional client hints, returning a boolean value. ```Elixir shelltv?(ua, client_hints \ nil) ``` @spec shelltv?( UAInspector.Result.t() | UAInspector.Result.Bot.t() | String.t() | nil, UAInspector.ClientHints.t() | nil ) :: boolean() ``` ``` -------------------------------- ### Unknown User Agent Handling with UAInspector Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Handles user agent strings that cannot be identified by the parser. Returns a `UAInspector.Result` struct with all fields set to `:unknown` except for the original user agent string. ```elixir iex> UAInspector.parse("--- undetectable ---") %UAInspector.Result{ browser_family: :unknown, client: :unknown, device: :unknown, os: :unknown, os_family: :unknown, user_agent: "--- undetectable ---" } ``` -------------------------------- ### Parse User Agent Without Bot Check Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Parses a user agent string but specifically excludes bot detection. This is useful when you need to analyze the user agent for other purposes without the bot classification. It returns a standard parsed result object. ```Elixir parse_client(ua, client_hints \ nil) ``` @spec parse_client(String.t() | nil, UAInspector.ClientHints.t() | nil) :: UAInspector.Result.t() ``` ``` -------------------------------- ### Bot Detection Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Checks if a given user agent string or parsed result represents a known bot. ```APIDOC ## GET /ua/is_bot ### Description Checks if a user agent is a known bot. ### Method GET ### Endpoint `/ua/is_bot` ### Query Parameters - **ua** (string) - Required - The user agent string to check. - **client_hints** (object) - Optional - Client hints object for more accurate detection. ### Response #### Success Response (200) - **is_bot** (boolean) - True if the user agent is a bot, false otherwise. #### Response Example ```json { "is_bot": true } ``` ``` -------------------------------- ### Check if User Agent is a Bot Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Determines if a given user agent string corresponds to a known bot. It accepts a user agent string, a bot result, or nil, along with optional client hints. Returns a boolean indicating whether it's a bot. ```Elixir bot?(ua, client_hints \ nil) ``` @spec bot?( UAInspector.Result.t() | UAInspector.Result.Bot.t() | String.t() | nil, UAInspector.ClientHints.t() | nil ) :: boolean() ``` ``` -------------------------------- ### Check if User Agent is a Mobile Device Source: https://hexdocs.pm/ua_inspector/v3.11.0/ua_inspector Determines if a user agent string belongs to a mobile device. This function processes the user agent string and optional client hints, returning a boolean result. ```Elixir mobile?(ua, client_hints \ nil) ``` @spec mobile?( UAInspector.Result.t() | UAInspector.Result.Bot.t() | String.t() | nil, UAInspector.ClientHints.t() | nil ) :: boolean() ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.