View source: R/scrape_reviews.R
scrape_reviews | R Documentation |
This function scrapes book reviews from Goodreads based on provided book IDs.
scrape_reviews(
book_ids_path,
num_reviews = 30,
use_parallel = FALSE,
num_cores = 4
)
book_ids_path |
A character string specifying the path to a file containing book IDs. |
num_reviews |
An integer specifying the number of reviews to scrape per book. Default is 30. |
use_parallel |
A logical value indicating whether to use parallel processing. Default is FALSE. |
num_cores |
An integer specifying the number of cores to use for parallel processing. Default is 4. |
A data frame containing scraped review information.
# Create a temporary file with sample book IDs
temp_file <- tempfile(fileext = ".txt")
writeLines(c("1420", "2767052", "10210"), temp_file)
# Run the function (with a small number of reviews to keep the example quick)
reviews <- scrape_reviews(temp_file, num_reviews = 5, use_parallel = FALSE)
print(head(reviews))
# Clean up: remove the temporary file
file.remove(temp_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.