R/response.r

Defines functions tidy_html.response

Documented in tidy_html.response

#' @export
#' @rdname tidy_html
tidy_html.response <- function(content, options=list(TidyXhtmlOut=TRUE),
                               verbose=FALSE) {

  if (!grepl("html", content$headers[["content-type"]])) {
    stop("htmltidy only parses HTML content from httr::response objects",
         call.=FALSE)
  }

  html_txt <- suppressMessages(httr::content(content, as="text"))

  tidy_html(html_txt)

}

Try the htmltidy package in your browser

Any scripts or data that you put into this service are public.

htmltidy documentation built on Oct. 4, 2019, 1:04 a.m.