@ -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")))
@ -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