# WeiboReview **Repository Path**: pasalai/WeiboReview ## Basic Information - **Project Name**: WeiboReview - **Description**: 微博评论获取(API) 情感分析 - **Primary Language**: Python - **License**: EPL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 2 - **Created**: 2020-01-06 - **Last Updated**: 2022-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WeiboReview 微博评论获取并情感分析 ![](https://img.shields.io/badge/python-3.7-green) ![](https://img.shields.io/badge/NLP-SnowNLP-green) ![](https://img.shields.io/badge/weiboAPI-sinaweibopy3-green) ![](https://img.shields.io/badge/Visualization-PyEcharts-green) 爬取指定的微博的评论,并进行情感分析 ## 运行说明 * 首先在[微博开发者平台](https://open.weibo.com)注册登录,并申请,[申请流程点这里](https://www.douban.com/note/449162780/)。 * 获取到开发者接口的App Key及App Secret(无需开发者认证及高级接口申请) * 在应用接口管理页面的应用信息>高级信息>OAuth2.0 授权设置中的授权回调页填写http://api.weibo.com/oauth2/default.html * 获取accessoken: 将得到的App Key及App Secret值填入本程序./weiboApi/weiboApi.py中对应的值,运行后将自动打开浏览器的微博OAuth2.0页面,在url中,包含一个code=*****,复制code值,回到本程序,将code的值填入程序运行后的输入栏,运行后输出accesstoken * 根据开发者文档的评论接口页面的接口说明,使用获得的accesstoken及相关微博文章的ID构造API链接,访问,并复制cookie,将./start.py中链接及cookie替换。 * 执行pip3 install -r requirements.txt安装引用到的库,或直接安装[Anaconda](https://www.anaconda.com/) * 运行./start.py,数据会自动格式化并保存至./outPut/评论.csv ## 更新日志 ### 2019年12月5日 * 创建项目 * 分析微博手机端H5页面,得到地址爬取评论 * 太难了,地址得手动获取,每页50条,且反扒机制TQL! ### 2019年12月6日 * 申请了微博API * 添加了通过AppKey及AppSecret获取access_token的程序(./weiboAPI):[olwolf/sinaweibopy3](https://github.com/olwolf/sinaweibopy3) * 根据[开发者文档](https://open.weibo.com/wiki/2/comments/show)构建获取评论的链接 https://api.weibo.com/2/comments/show.json?access_token=[your_access_token]&id=[微博的ID]&count=[1~200]200&page=1 ### 2019年12月10日 * 更新README.md,增加运行过程说明 * 爬取香港相关微博的评论,数据保存为./outPut/getInfo.json及评论内容./outPut/评论.csv