Browse Source

Can't test this on macOS 10.13 but it's now fully working on Linux and I'll try to test on Windows soon.

master
boB Rudis 6 years ago
parent
commit
c9b8fa0cae
  1. 4
      R/onAttach.R
  2. 3
      R/read-html.r

4
R/onAttach.R

@ -18,6 +18,10 @@
Sys.setenv(HEADLESS_CHROME="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome")
}
if (unname(Sys.info()["sysname"] == "Lniux")) {
Sys.setenv(HEADLESS_CHROME="/usr/bin/google-chrome")
}
message(sprintf("Set Chrome binary to [%s].\nPass in manually to functions or use decapitated::set_chrome_env()",
Sys.getenv("HEADLESS_CHROME")))

3
R/read-html.r

@ -10,8 +10,7 @@
chrome_read_html <- function(url, chrome_bin=Sys.getenv("HEADLESS_CHROME")) {
url <- shQuote(url)
tmp <- system2(chrome_bin, c("--headless", "--disable-gpu", "--dump-dom", url), stdout=TRUE)
print(tmp)
xml2::read_html(tmp)
xml2::read_html(paste0(tmp, collapse="\n"))
}
#' "Print" to PDF

Loading…
Cancel
Save