Skip to contents

get_url_domain() retrieves the Web domain name from a URL, including URLs shortened with services such as bit.ly and t.co

Usage

get_url_domain(x, wait = 10)

Arguments

x

A list or vector of hyperlinks, whether shortened or expanded

wait

How long (in seconds) to wait on the longurl::expand_urls() function to retrieve the full, expanded URL from a shortened URL (e.g., a bit.ly). The longurl default is 2 seconds, but we have found that this misses a number of valid URLs. Here, we have made the default wait = 10 seconds, but the user can adjust this as they like.

Value

A list or vector of Web domain names

See also

Read the documentation for longurl::expand_urls() and urltools::domain().

Examples


get_url_domain("https://www.tidyverse.org/packages/")
#> [1] "tidyverse.org"
get_url_domain("https://dplyr.tidyverse.org/")
#> [1] "dplyr.tidyverse.org"
get_url_domain("http://bit.ly/2SfWO3K")
#> [1] "aect.org"