R Selenium TripAdvisor 详细会员信息
R Selenium TripAdvisor detailed member info
我正在尝试获取有关撰写特定评论的评论者的详细信息。
问题是当你移动到某个部分时,评论者的信息弹出。我可以用硒做到这一点。
url<-"https://www.tripadvisor.com/Hotel_Review-g644300-d668891-Reviews-Hotel_Creina-Kranj_Upper_Carniola_Region.html#REVIEWS"
driver<- rsDriver()
remDr <- driver[["client"]]
remDr$open()
remDr$navigate(url)
details <- remDr$findElement(using = "xpath", paste("(//div[@class='username mo'])"))
remDr$mouseMoveToLocation(webElement=details)
我怎样才能得到一个memberid? See image.
图书馆(rvest)
h<-read_html(url)
id<-html_attr(html_node(h,".expand_inline"),"class")
id 是 expand_inline scrname mbrName_9520BF5DXXXXX
id2<-gsub("expand_inline scrname mbrName_","",id)
id2 是 9520BF5DXXXXX
indurl<-paste0("https://www.tripadvisor.co.kr/MemberProfile-a_uid.",id2)
indinfo<-read_html(indurl)
名称<-html_text(html_node(indinfo,".nameText"));名称
我正在尝试获取有关撰写特定评论的评论者的详细信息。
问题是当你移动到某个部分时,评论者的信息弹出。我可以用硒做到这一点。
url<-"https://www.tripadvisor.com/Hotel_Review-g644300-d668891-Reviews-Hotel_Creina-Kranj_Upper_Carniola_Region.html#REVIEWS"
driver<- rsDriver()
remDr <- driver[["client"]]
remDr$open()
remDr$navigate(url)
details <- remDr$findElement(using = "xpath", paste("(//div[@class='username mo'])"))
remDr$mouseMoveToLocation(webElement=details)
我怎样才能得到一个memberid? See image.
图书馆(rvest)
h<-read_html(url)
id<-html_attr(html_node(h,".expand_inline"),"class")
id 是 expand_inline scrname mbrName_9520BF5DXXXXXid2<-gsub("expand_inline scrname mbrName_","",id)
id2 是 9520BF5DXXXXXindurl<-paste0("https://www.tripadvisor.co.kr/MemberProfile-a_uid.",id2)
indinfo<-read_html(indurl)
名称<-html_text(html_node(indinfo,".nameText"));名称