Ваш xpath должен быть header/h3/a
, а не /header/h3/a
.Начальная косая черта подразумевает, что вы хотите снова начать с корня дерева, а не с текущего узла.
xx <- read_html("https://channel9.msdn.com/Events/useR-international-R-User-conferences/useR-International-R-User-2017-Conference?sort=status&direction=desc&page=14")
xx %>% html_nodes(xpath = "/html/body/main/section[2]/div/article") %>%
map_df(~list(title = html_nodes(.x, xpath = 'header/h3/a') %>%
html_text() %>% {if(length(.) == 0) NA else .}, # replace length-0 elements with NA
length = html_nodes(.x, xpath = 'a/time') %>%
html_text() %>% {if(length(.) == 0) NA else .}))
# title length
# <chr> <chr>
# 1 " Introduction to Natural Language Processing with R II" 01:15:00
# 2 " Introduction to Natural Language Processing with R" 01:22:13
# 3 " Solving iteration problems with purrr II" 01:22:49
# 4 " Solving iteration problems with purrr" 01:32:23
# 5 Markov-Switching GARCH Models in R: The MSGARCH Package 15:55
# 6 Interactive bullwhip effect exploration using SCperf and Shiny 16:02
# 7 Actuarial and statistical aspects of reinsurance in R 14:15
# 8 Transformation Forests 16:19