Web Scraping w R
Timo Grossenbacher
Instructor
//div/p[@class = "blue"] (odpowiednik: div > p.blue)div zawierające węzły a z klasą special
html %>%
html_elements(xpath = '//p')
# CSS selector equivalent: p
html %>%
html_elements(xpath = '//body//p')
# CSS selector equivalent: body p
html %>%
html_elements(xpath = '/html/body//p')
# CSS selector equivalent: html > body p

html %>%
html_elements(xpath = '//div/p')
# CSS selector equivalent: div > p

html %>%
html_elements(xpath = '//div[a]')
# CSS selector equivalent: none
/ lub //span i a[...]//span/a[@class = "external"] (CSS: span > a.external) //*[@id = "special"]//div (CSS: #special div lub *#special div)Web Scraping w R