Given a valid HTML/XML document, node set or single node, a claracter vector of all <body> <a href> URLs will be returned. If base is not NULL all relative URLs will be converted to absolute URLs.

body_anchor_urls(x, unique = FALSE, base = NULL)

Arguments

x

Either a document, a node set or a single node.

unique

if TRUE, then only unique URLs will be returned. Default: FALSE.

base

if not NULL, all relative URLs will be converted to absolute URLs. Default: NULL.

Value

character vector of extracted URLs; if no <a> href URLs were discovered charactrer(0) will be returned.

Examples

# NOT RUN {
x <- rvest::read_html("https://congress.gov/")
body_anchor_urls(x, unique = TRUE, base = "https://congress.gov/")
# }