R语言微博评论爬虫练习

1.随意选个热点微博

2. 参考

R微博数据分析

 http://blog.sina.com.cn/s/blog_9bed162b0102wu1w.html

R语言实现代码
devtools::install_github("sjhfx/rwda")
library(rwda)
access_token = "2.00xxxxxxxxx"
weiboid = "4181525459234737"
df_comments = get_comments(access_token, weiboid, maxpage = 20)
weibo_cloud(df_comments, stopwords = c("心心", "回复"))
 
3. 看看大家的看法
 
过程中遇到的困难主要在于 获取新浪微博的access_token , access_token可以通过 http://open.weibo.com/tools/console 获取。
个人创建了一个网页应用,最后获取access_token时采用的方法是 用谷歌浏览器,添加应用 Postman,在Postman中运用Post 请求获取access_token。
 
最后,顺手

 又顺手

原文地址:https://www.cnblogs.com/JaniceZD/p/7986962.html