#' Scrape a Chapter of Desired Fanfiction
#'
#' @description
#' \code{getChapter.absentfan} Helper function of getChapter scraping a single chapter from specific entry in fanfiction.net.
#'
#' @param returns A list generated by getTitles including the fanfiction.net url and href tag of associated fanfic.
#' @export
#' @return The raw text scraped from a chapter of fanfiction
#' @examples
#' getChapter(list(url="https://www.fanfiction.net/s/13084808/1/Modern-Marauders",href="/s/13084808/1/Modern-Marauders"))
getChapter <- function(returns) {
url <- returns[[1]]
href <- returns[[2]]
# get all of the chapter text
nodes <- url %>% read_html() %>%
html_nodes("body > #content_parent > #content_wrapper > #content_wrapper_inner > #storytextp > #storytext > p") %>%
html_text()
return(nodes)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.