Reputation: 21
I am trying to pull title descriptions using the rvest package in R and SelectorGadget to identify my CSS selectors.
<div class="detail">
<h3 class="">
<a href="[].html"
title="Vasyl Lomachenko Beats Guillermo Rigondeaux"
class="">Madison Square Garden...</a>
Currently using the following code which selects h3 class data: "Madison Square Garden...". I want to select the title data i.e. "Vasyl Lomachenko Beats Guillermo Rigondeaux".
url <- 'www.url.com'
webpage <- read_html(url)
Desc <- html_nodes(webpage,'h3') %>% html_text()
I have referred to this question below but still can't work it out. Any help would be very welcome!
Scraping image titles with rvest
Upvotes: 0
Views: 778
Reputation: 21
Super simple, hadn't used html_attr before:
webpage %>% html_nodes("h3 a") %>% html_attr("title")
Upvotes: 1