8000 Feature request: Combined read_html/write_html function · Issue #193 · r-lib/xml2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feature request: Combined read_html/write_html function #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
richierocks opened this issue Oct 12, 2017 · 0 comments
Closed

Feature request: Combined read_html/write_html function #193

richierocks opened this issue Oct 12, 2017 · 0 comments

Comments

@richierocks
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0