我添加了一些代码,旨在使用R
来抓取Google +评论library(rvest)
library(xml2)
devtools::install_github("ropensci/RSelenium")
rmDr=rsDriver(browser = "chrome")
myclient= rmDr$client
myclient$navigate("https://www.google.co.uk/search?q=queen%27s+hospital+romford&oq=queen%27s+hospitql+&aqs=chrome.1.69i57j0l5.5843j0j4&sourceid=chrome&ie=UTF-8#lrd=0x47d8a4ce4aaaba81:0xf1185c71ae14d00,1,,,")
pagesource= myclient$getPageSource()[[1]]
#Now I used the SelectorGadget tool to identify the relevant part I’d like to scrape
reviews=read_html(pagesource) %>%
html_nodes(".review-snippet") %>%
html_text()
但是,一旦我运行代码,我会在最后一部分收到错误消息:
chrome无法访问\ n(会话信息:chrome = XX.X.XXXX.XXX)\ n (驱动信息:chromedriver = X.XX.XXXXX (XXXXXXXXXXXXXXXXXXXX),platform = Windows NT XX.X.XXXX x86_64)
我试图查看其他stackoverflow帖子以寻找解决方案,但是找不到适用于R的解决方案。
任何想法都将受到高度赞赏!