urlparse
urlparse(
urlstring:string,scheme:string,allowFragments:boolean):ParseResult
Defined in: packages/pythonlib/src/urllib.ts:52
Parse a URL into its components.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
urlstring | string | undefined | The URL to parse |
scheme | string | "" | Default scheme if not present in URL |
allowFragments | boolean | true | Whether to parse fragments (default: true) |
Returns
Parsed URL components
Example
const result = urlparse("https://user:pass@example.com:8080/path?query=1#frag")console.log(result.scheme) // "https"console.log(result.hostname) // "example.com"console.log(result.port) // 8080