# Load necessary libraries
library(xml2)
library(dplyr)
# Define the URL of the RSS feed
url <- "https://www.goodreads.com/review/list_rss/122662610?key=nsX43GnJ3fLp_yMJWXqdXk_FgbeJQw3eER6uwLRFluIEgixA&shelf=read"
# Read the RSS feed
rss_feed <- read_xml(url)
# Extract relevant data
items <- xml_find_all(rss_feed, "//item")
# Function to extract text from a node
get_text <- function(node, xpath) {
result <- xml_find_first(node, xpath)
if (is.null(result)) return(NA)
xml_text(result)
}
# Parse the RSS feed
books <- tibble(
title = sapply(items, get_text, ".//title"),
author = sapply(items, get_text, ".//author_name"),
publication_year = sapply(items, get_text, ".//book_published"),
link = sapply(items, get_text, ".//link"),
image = sapply(items, get_text, ".//book_large_image_url")
)