css选择器中的基础超链接href地址

css选择器中的基础超链接href地址,r,css-selectors,rvest,R,Css Selectors,Rvest,这段代码: library(tidyverse) library(rvest) url <- "http://www.imdb.com/title/tt4116284/" director <- read_html(url) %>% html_nodes(".summary_text+ .credit_summary_item .itemprop") %>% html_text() 库(tidyverse) 图书馆(rvest) url% htm

这段代码:

library(tidyverse)
library(rvest)

url <- "http://www.imdb.com/title/tt4116284/"

director <- read_html(url) %>% 
    html_nodes(".summary_text+ .credit_summary_item .itemprop") %>% 
    html_text()
库(tidyverse)
图书馆(rvest)
url%
html_text()
将获取纯文本值“克里斯·麦凯”(新乐高蝙蝠侠电影的导演)。但是,基础的超链接href地址指向:
http://www.imdb.com/name/nm0003021?ref_=tt_ov_dr


我想要那个。如何调整css选择器以获取基础的hyperlink href地址?

获取父级
a
标记的
href
属性:

director <- read_html(url) %>% 
    html_nodes(".summary_text+ .credit_summary_item span a") %>% 
    html_attr('href')
director%
html_节点(“.summary_text+.credit_summary_item span a”)%>%
html_attr('href')