悬赏 88 个论坛币 未解决
以豆瓣网址为例https://book.douban.com/top250?icn=index-book250-all
我想爬取前25本书的书名,代码如下:
library(stringi)
library(rvest)
library(RCurl)
library(XML)
web<-read_html("https://book.douban.com/top250?icn=index-book250-all",encoding="UTF-8")
position<-web %>% html_nodes("td") %>% html_nodes("div") %>% html_nodes("a") %>% html_text()
position
出来的结果是这样:
如图,有很多斜杠,怎么才能把斜杠去掉,只留下书名呢?谢谢各位