An update to “An adventure in downloading books”

May 2, 2020
By

[This article was first published on Anindya Mozumdar, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I received an email from Bernardo Lares as feedback on my previous article. You can also view some of the other cool work done by him in this link.

His script is provided below. He uses the rvest package and the %>% operator to keep it really short and simple.

library(rvest)
library(dplyr)
library(stringr)

list <- "https://towardsdatascience.com/springer-has-released-65-machine-learning-and-data-books-for-free-961f8181f189"
aux <- read_html(list) %>%
  html_node("div") %>%
  html_text() %>%
  str_split("http://link.springer.com/openurl\\?genre=book&isbn=")
ids <- substr(unlist(aux), 1, 17)[-1]
sapply(ids, function(x) {
  url <- paste0("https://link.springer.com/content/pdf/10.1007%2F", x, ".pdf")
  download.file(url, paste0(x, ".pdf"), mode = "wb")
})

To leave a comment for the author, please follow the link and comment on their blog: Anindya Mozumdar.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)