Skip to content

Commit

Permalink
Use readMDTable for retrieving mirrors (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdnbradford authored Sep 17, 2024
1 parent 26a6154 commit ba2147f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Imports:
dplyr,
glue,
purrr,
readMDTable,
readr,
rlang,
stringr,
Expand Down
11 changes: 2 additions & 9 deletions R/gutenberg_mirrors.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,8 @@ gutenberg_get_mirror <- function(verbose = TRUE) {
#' @export
gutenberg_get_all_mirrors <- function() {
mirrors_url <- "https://www.gutenberg.org/MIRRORS.ALL"
mirrors_md <- read_url(mirrors_url)
tmp <- tempfile(fileext = ".md")
writeLines(mirrors_md, tmp)
mirrors <- suppressWarnings(
readr::read_delim(
tmp,
delim = "|",
trim_ws = TRUE
) |>
mirrors <- suppressWarnings( # Table has extra row that causes vroom warning
readMDTable::read_md_table(mirrors_url, warn = FALSE) |>
dplyr::slice(2:(dplyr::n() - 1))
)

Expand Down

0 comments on commit ba2147f

Please sign in to comment.