'problem with classes when scraping tripadvisor with rvest
I am trying to scrape tripadvisor reviews. I use the code
trip_ad <- read_html("http://www.tripadvisor.com/Hotel_Review-g189400-d10798588-Reviews-Electra_Metropolis_Athens-Athens_Attica.html")
house <- trip_ad %>%
html_elements("#REVIEWS .innerBubble")
But it returns a list of 0.
The same is if I try
review <- trip_ad %>%
html_elements(".XllAv H4 _a")
Could you help?
Solution 1:[1]
Try this and lmk.
review <- trip_ad %>%
html_nodes(".XllAv H4 _a") %>%
html_text()
Solution 2:[2]
The issue was resolved in the way bellow
read_html("home/tripad/file_saved_using_firefox.html")
reviews4 <- reviews3 %>%
html_elements("#REVIEWS .innerBubble")```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lucca Nielsen |
Solution 2 | eirinivl |