# Parse a vector of URLs into one row each.
urls <- c(
"https://www.Example.co.uk/Blog/index.html?utm_source=nl&id=7#top",
"http://sub.example.com:8080/a/./b/../c"
)
safe_parse_urls(urls)[, c("scheme", "host", "domain", "tld", "path")]
# Reach a single component without materializing the frame.
get_domain(urls)
get_subdomain(urls)
# Clean for SEO: a lossy projection of a WHATWG parse. Dot segments resolve,
# the host renders in Unicode, www/index come off, the query is dropped.
get_clean_url(urls, profile = "seo")
# Profiles are inspectable sugar over the low-level knobs, and an explicit
# argument always overrides the bundle.
url_profile("seo")
get_clean_url("https://xn--mnchen-3ya.de/a", profile = "seo")
get_clean_url("https://xn--mnchen-3ya.de/a", profile = "seo",
host_encoding = "keep")
Run the code above in your browser using DataLab