Соскреб в Google Play: как определить реакцию на отзывы приложений в R? - PullRequest
0 голосов
/ 07 ноября 2019

Я занимаюсь поиском в Интернете отзывов о приложении Google Play, но не могу определить отсутствие ответа на отзывы.

Объясняю. Я намерен создать базу данных с двумя столбцами. Один с текстом обзора, а другой столбец с ответом приложения на этот обзор. В этом последнем столбце он будет иметь пустые значения, когда ответа нет. Однако я получаю только ответы и не могу определить отсутствие ответа. Как это можно сделать?

ВХОД

enter image description here

OUPUT Что я хочу вернуть

enter image description here

Как я могу получить это? Определите отсутствие ответа

ПОЛНЫЙ КОД

#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()

#1 column
reviews <- html_obj %>% html_nodes(".UD7Dzf") %>% html_text()

#2 column
reply <- html_obj %>% html_nodes('.LVQB0b') %>% html_text()


# create the df with all the info
review_data <- data.frame(reviews = reviews, reply = reply, stringsAsFactors = F)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...