Skip to content

Feature request: Combined read_html/write_html function #193

@richierocks

Description

@richierocks

If you are scraping a website, it is good practise to download the page once and store a copy, so you don't have to keep re-downloading it.

That means that it is easy to end up with lots of code like

page <- read_html(url)
write_html(page, "somefile.html")

It seems like it would be useful to have a single function (save_html() perhaps) to do both operations.

The dumbest implementation is something like this:

save_html <- function(x, file) {
  page <- read_html(x)
  message("Writing to ", force(file))
  write_html(page, file)
  invisible(page)
}

It needs a bit of fleshing out to deal with ... args to read_html() and write_html(), to it would be nice to have a default filename generated from the URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions