library(XML)
library(RCurl)
strurl<-‘https://movie.douban.com/top250’
movie<-RCurl::getURL(strurl)
movie=htmlParse(movie)
nodes<-getNodeSet(movie,”//div[@class=’info’]//a//span[1]”)
moviename<-sapply(nodes, xmlValue)
moviename[1:10]
[1] “肖申克的救赎” “霸王别姬” “阿甘正传” “这个杀手不太冷” “泰坦尼克号” “美丽人生” “千与千寻”
[8] “辛德勒的名单” “盗梦空间” “忠犬八公的故事”