A package to download free Springer books during Covid-19 quarantine

Antoine Soetewey 2020-04-26 42 minute read

Update

The promotion has ended so it is not possible to download the books through R. If you did not download the books in time, you can still have access to them via this link.1

Introduction

You probably already have seen that Springer released about 500 books for free following the COVID-19 pandemic. According to Springer, these textbooks will be available free of charge until at least the end of July.

Following this announcement, I already downloaded a couple of statistics and R programming textbooks from their website and I will probably download a few more in the coming weeks.

In this article, I present a package that saved me a lot of time and which may be of interest to many of us: the {springerQuarantineBooksR} package, developed by Renan Xavier Cortes.

This package allows you to easily download all (or a selection of) Springer books made available free of charge during the COVID-19 quarantine.

With this large collection of high quality resources and my collection of top R resources about the Coronavirus, we do not have any excuse to not read and learn during this quarantine.

In this article, I show:

  • how to download all available textbooks at once and
  • how to download a subset of books, given a specific title, author or subject

Without further ado, here is how the package works in practice.

Installation

After having installed the {devtools} package, you can install the {springerQuarantineBooksR} package from GitHub and load it with:

# install.packages("devtools")
devtools::install_github("renanxcortes/springerQuarantineBooksR", force = TRUE)
library(springerQuarantineBooksR)

Download all books at once

First, set the path where you would like to save all books with the setwd() function then download all of them at once with the download_springer_book_files() function. Note that it takes several minutes (depending on the speed of your internet connection) since all books combined amount for almost 8GB.

setwd("path_of_your_choice") # where you want to save the books
download_springer_book_files() # download all of them at once

You will find all downloaded books (in PDF format) in a folder named “springer_quarantine_books”, organized by category.2

If you want to download the EPUB version (or both the PDF and EPUB versions), add the filetype argument to the function:

# for EPUB version:
download_springer_book_files(filetype = "epub")

# for both PDF and EPUB versions:
download_springer_book_files(filetype = "both")

By default, it downloads only the English books. However, it is also possible to download all German books by adding the argument lan = 'ger':

download_springer_book_files(lan = "ger")

Note that in total, there are 407 unique titles in English and 52 in German.

Create a table of Springer books

Like me, if you do not know which books are offered by Springer and you do not want to download all of them, you probably may want to have an overview or a list of the released books before downloading any.

For this, you can load a table containing all the titles made available by Springer into an R session with the download_springer_table() function:

springer_table <- springerQuarantineBooksR::download_springer_table()

This table can then be improved with the {DT} package to:

  • keep only a minimum of information,
  • allow searching a book by its title, author, classification or year,
  • allow downloading the list of available books, and
  • make the Springer links clickable for instance
# install.packages("DT")
library(DT)

springer_table$open_url <- paste0(
  '<a target="_blank" href="', # opening HTML tag
  springer_table$open_url, # href link
  '">SpringerLink</a>' # closing HTML tag
)

springer_table <- springer_table[, c(1:3, 19, 20)] # keep only relevant information

datatable(springer_table,
  rownames = FALSE, # remove row numbers
  filter = "top", # add filter on top of columns
  extensions = "Buttons", # add download buttons
  options = list(
    autoWidth = TRUE,
    dom = "Blfrtip", # location of the download buttons
    buttons = c("copy", "csv", "excel", "pdf", "print"), # download buttons
    pageLength = 5, # show first 5 entries, default is 10
    order = list(0, "asc") # order the title column by ascending order
  ),
  escape = FALSE # make URLs clickable
)

This table allows you to see which textbooks Springer offers (together with some information) and allows you to find the ones that you are most likely to be interested in.

Note that you can create a similar table for German books with the download_springer_table(lan = "ger") function.

Download only specific books

Now that you have a better idea about the books you are interested in, you can download them by their title, author or subject.

By title

Say that you are interested in downloading only one specific book and you know its title. For instance, suppose you want to download the book entitled “All of Statistics”:

download_springer_book_files(springer_books_titles = "All of Statistics")

If you are interested to download more than one book, run the following command:

download_springer_book_files(
  springer_books_titles = c(
    "All of Statistics",
    "A Modern Introduction to Probability and Statistics"
  )
)

Alternatively, if you do not have a specific title in mind but you are interested in downloading all books with the word “Statistics” in the title, you can run:

springer_table <- download_springer_table()

library(dplyr)
specific_titles_list <- springer_table %>%
  filter(str_detect(
    book_title, # look for a pattern in the book_title column
    "Statistics" # specify the word
  )) %>%
  pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

Tip: If you would like to download all books with the word “Statistics” or “Data Science” in the title, replace "Statistics" in the above code by "Statistics|Data Science".

By author

If you want to download all books from a specific author, you can run:

springer_table <- download_springer_table()

# library(dplyr)
specific_titles_list <- springer_table %>%
  filter(str_detect(
    author, # look for a pattern in the author column
    "John Hunt" # specify the author
  )) %>%
  pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

By subject

You can also download all textbooks covering a specific subject (see all subjects in the subject_classification column in the summary table). For instance, here is how to download all books categorized in the Statistics subject:

springer_table <- download_springer_table()

# library(dplyr)
specific_titles_list <- springer_table %>%
  filter(str_detect(
    subject_classification, # look for a pattern in the subject_classification column
    "Statistics" # specify the subject
  )) %>%
  pull(book_title)

download_springer_book_files(springer_books_titles = specific_titles_list)

Improvements

Below a list of features that can potentially be implemented in order to improve the package:

  • Add the possibility to download all editions of a book. Currently, only the latest edition can be downloaded.
  • Add the possibility to resume downloading if it stopped. Currently, if the code is executed again, the downloads start from scratch.
  • Add the possibility of downloading books by topic. Currently, it is only possible by title, author or subject.

Feel free to open a pull request on GitHub if you have another improvement in mind.

Acknowledgments

I would like to thank:

  • Renan Xavier Cortes (and all contributors) for providing this package
  • The springer_free_books Python project which was used as inspiration to the {springerQuarantineBooksR} package
  • And last but not least, Springer who offers many of their excellent books for free!

Conclusion

Thanks for reading.

I hope this article will help you to download and read more high quality materials made available by Springer during this Covid-19 quarantine.

As always, if you have a question or a suggestion related to the topic covered in this article, please add it as a comment so other readers can benefit from the discussion.


  1. Note that I am not the author nor the maintainer of this shared folder. Therefore, I do not know how long the books will be available through this link, and I am not responsible if some (or all) books are removed.↩︎

  2. Note that you can change the folder name by specifying the argument destination_folder = "name_of_your_choice".↩︎



Liked this post?

  • Get updates every time a new article is published (no spam and unsubscribe anytime):

  • Support the blog
  • Share on: