r - Google Play 网页抓取:如何获得 R 中每条评论的投票数?
问题描述
我正在 R 中对 Google Play 应用程序的评论进行网络抓取,但我无法获得投票数。我指出代码:likes <- html_obj %>% html_nodes(".xjKiLb") %>% html_attr("aria-label")我没有得到任何价值。怎么做到呢?
获得刮票
完整代码
#Loading the rvest package
library(rvest)
library(magrittr) # for the '%>%' pipe symbols
library(RSelenium) # to get the loaded html of
url <- 'https://play.google.com/store/apps/details?id=com.gospace.parenteral&showAllReviews=true'
# starting local RSelenium (this is the only way to start RSelenium that is working for me atm)
selCommand <- wdman::selenium(jvmargs = c("-Dwebdriver.chrome.verboseLogging=true"), retcommand = TRUE)
shell(selCommand, wait = FALSE, minimized = TRUE)
remDr <- remoteDriver(port = 4567L, browserName = "firefox")
remDr$open()
# go to website
remDr$navigate(url)
# get page source and save it as an html object with rvest
html_obj <- remDr$getPageSource(header = TRUE)[[1]] %>% read_html()
likes <- html_obj %>% html_nodes(".xjKiLb") %>% html_attr("aria-label")
什么回报我
啦〜啦〜啦
我想要退回的东西
3 3 2
解决方案
推荐阅读
- kubernetes - 检索无法将 yaml 转换为 json 错误 kubernetes yaml
- flutter - 我被困在运行 gradle 任务“assembledebug”
- flutter - Flutter:如何在 Wrap 小部件内滚动列表?
- aspnetzero - 使用 RAD 电动工具添加实体时的样式问题
- android - 如何显示弹出通知,例如什么是应用呼叫通知?
- flutter - Flutter 中的小部件/图像翘曲和失真
- python - Python Dictionary 自动检查值是否不存在并返回默认值
- c# - 我如何以线程安全的方式获取异步(memoryCache)c#
- python - 使用键盘模块时如何清除输入?
- javascript - 如何呈现空值