Skip to contents

This function takes a file path containing Goodreads book IDs and retrieves the author information for each book.

Usage

get_author_info(file_path)

Arguments

file_path

A character string specifying the path to the file containing Goodreads book IDs.

Value

A named list where each element contains the author information for a book.

Examples

# \donttest{
# Create a temporary file with sample book IDs
temp_file <- tempfile(fileext = ".txt")
writeLines(c("1420", "2767052", "10210"), temp_file)
# Run the function
author_info <- get_author_info(temp_file)
print(author_info)
#> $`1420`
#> {html_node}
#> <a class="ContributorLink" href="https://www.goodreads.com/author/show/947.William_Shakespeare">
#> [1] <span class="ContributorLink__name" data-testid="name">William Shakespear ...
#> 
#> $`2767052`
#> {html_node}
#> <a class="ContributorLink" href="https://www.goodreads.com/author/show/153394.Suzanne_Collins">
#> [1] <span class="ContributorLink__name" data-testid="name">Suzanne Collins</s ...
#> 
#> $`10210`
#> {html_node}
#> <a class="ContributorLink" href="https://www.goodreads.com/author/show/1036615.Charlotte_Bront_">
#> [1] <span class="ContributorLink__name" data-testid="name">Charlotte Brontë</ ...
#> 
# Clean up: remove the temporary file
file.remove(temp_file)
#> [1] TRUE
# }