I have been searching and reading number of rvest related articles on how to web scrape. Unfortunately, my attempts to learn various components involved has been unsuccessful. I understand some HTML syntax and am fluent in r but this is my first time working with rvest.
This is the source (inspect view):
I’m trying to extract various pieces of information. I started with a test case on ” title”. Here is my code so far…
read_html(x) %>% html_elements(xpath = "//*[@class = 'container']") %>%
html_elements(xpath = ".//*[@class = 'searching row']") %>%
html_elements(xpath = ".//*[@class = 'col-sm-8']") %>%
html_elements(xpath = ".//*[@class = 'results']") %>%
html_text()
"n "
As you can see, in the results class, I’m getting blank. What can I change to make this code work?
Thank you.