# url.parse ## Function Parses the current URL into an object. ## Syntax ```bt url(text).parse() ``` ## Parameters None. ## Return value | Type | Description | | ------ | ------ | | Object | Returns the URL parsing object. See "Return Object Fields" below for fields. | ## Return object fields | Field | Type | Must exist | Description | | ------ | ------ | ------ | ------ | | scheme | String | Yes | URL scheme, excluding `:`, such as `http`, `https`. | | username | String | Yes | URL username. Empty string if there is no username. | | password | String/Empty | Yes | URL password. `empty` without password. | | host | String/Empty | Yes | A hostname or IP string. When the URL does not have a host, it is `empty`. | | port | Int/Empty | Yes | Explicit port number. When the URL does not explicitly provide a port, it is `empty`, and the default port of the scheme will not be returned. | | path | String | Yes | URL path, usually starting with `/`. | | query | String/Empty | Yes | The original query string without `?`. `empty` without query string. | | fragment | String/Empty | Yes | URL fragment without `#`. `empty` without fragment. | | origin | String | is the ASCII serialization result of | the URL origin, for example `https://btlang.org`. | | url | String | Yes | The complete URL string after normalization. | ## Code Example ```bt info = url('https://btlang.org/docs?q=BT').parse() // Output: btlang.org print info.host ``` ## Notes - A runtime error is thrown when the URL cannot be parsed. - `password`, `host`, `port`, `query`, and `fragment` return `empty` when the corresponding optional URL components are absent.