Download Public Domain Works from Wikisource

Download public domain works from Wikisource < https://wikisource.org/>, a free library from the Wikimedia Foundation project.


The wikisourcer R package helps you download public domain works from the free library Wikisource.

It includes two functions for downloading books and pages by url.

  • wikisource_book() to download a book
  • wikisource_page() to download a page

Installation

install.packages("wikisourcer") # install release version from CRAN
devtools::install_github("lgnbhl/wikisourcer") # install development version from GitHub

Minimal examples

Download Voltaire’s philosophical novel Candide.

library(wikisourcer)
 
wikisource_book("https://en.wikisource.org/wiki/Candide")

Download Voltaire’s Candide books in French, Spanish and Italian.

library(purrr)
 
fr <- "https://fr.wikisource.org/wiki/Candide,_ou_l%E2%80%99Optimisme/Garnier_1877"
es <- "https://es.wikisource.org/wiki/C%C3%A1ndido,_o_el_optimismo"
it <- "https://it.wikisource.org/wiki/Candido"
 
purrr::map_df(c(fr, es, it), wikisource_book)

Download Sonnet 18 of William Shakespeare.

library(wikisourcer)
 
wikisource_page("https://en.wikisource.org/wiki/Sonnet_18_(Shakespeare)", "Sonnet 18")

Download 154 Sonnets of William Shakespeare.

library(purrr)
 
urls <- paste0("https://en.wikisource.org/wiki/Sonnet_", 1:154, "_(Shakespeare)") #154 urls
 
purrr::map2_df(urls, paste0("Sonnet ", 1:154), wikisource_page)

For more information on how to use wikisourcer, please read the vignette.

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("wikisourcer")

0.1.2 by Félix Luginbuhl, 2 months ago


https://github.com/lgnbhl/wikisourcer


Report a bug at https://github.com/lgnbhl/wikisourcer/issues


Browse source code at https://github.com/cran/wikisourcer


Authors: Félix Luginbuhl [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, rvest, stringr, purrr, xml2, urltools

Suggests knitr, rmarkdown, ggplot2, tidyr, tidytext, widyr, SnowballC, ggraph, igraph


See at CRAN