This function reads book IDs from a file, fetches the corresponding Goodreads pages, and extracts the genres for each book.
Value
A named list where each element corresponds to a book ID and contains a character vector of genres for that 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
genres <- get_genres(temp_file)
# Display the results
print(genres)
#> $`1420`
#> character(0)
#>
#> $`2767052`
#> character(0)
#>
#> $`10210`
#> character(0)
#>
# Clean up: remove the temporary file
file.remove(temp_file)
#> [1] TRUE
# }