全部版块 我的主页
论坛 站务区 十一区 新手入门区
941 0
2020-05-18
#导入包
library(rvest)
library(stringr)
library(xml2)
#检索评论得到的url
url <- "https://movie.douban.com/subject/26794435/comments?status=P"
#读取html
web<-read_html(url,encoding="UTF-8")
web
#获取第一页的评论内容(直接看标签正则)
comment_date <- web %>% html_nodes("div p span.short") %>% html_text()
comment_date
str_replace(comment_date, " \n", "") #替换
str_replace(comment_date, "\n", "")
#数据框返回
date.frame(comment_date)

运行结果显示 没有"date.frame"这个函数
新手跪求各位大佬解答
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群