download_webpage_txt
saves output to a .txt file.
download_webpage_pdf
saves output to a .pdf file.
Usage
download_webpage_txt(
url,
output_filepath = NA,
output_dir = "input",
output_filename = "posting.txt",
base_dir = "."
)
download_webpage_pdf(
url,
output_filepath = NA,
output_dir = "input",
output_filename = "posting.pdf"
)
See also
Other report-dev:
find_matches_and_positions()
,
prep_term_list()
Examples
library(rvest, warn.conflicts = FALSE)
url <- "https://en.wikipedia.org/wiki/R_(programming_language)"
fil <- tempfile("file", tempdir(), fileext = ".txt")
download_webpage_txt(url, fil)
#> ✔ Writing file: ../../../../../../../tmp/RtmpxhNRJk/file9ba22028ec46.txt
readLines(fil, n = 1)
#> [1] "R (programming language) - Wikipedia(function(){var className=\"client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available\";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\\w+$|[^\\w-]+/g,'')+'-clientpref-\\\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={\"wgBreakFrames\":false,\"wgSeparatorTransformTable\":[\"\",\"\"],\"wgDigitTransformTable\":[\"\",\"\"],\"wgDefaultDateFormat\":\"dmy\","
unlink(fil)
url <- "https://stat.ethz.ch/R-manual/R-devel/library/utils/html/download.file.html"
fil <- tempfile("file", tempdir(), fileext = ".pdf")
download_webpage_pdf(url, fil)
unlink(fil)