python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论——学霸君
python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论——学霸君
import requests
import re
import requests
from bs4 import BeautifulSoup as bs
import json
import csv
import redef getHTMLText(url):header = {'referer': 'https://appgallery.huawei.com/','user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0','Connection': 'keep-alive'}try:r = requests.get(url, timeout=30,headers=header)r.raise_for_status()r.encoding = r.apparent_encodingreturn r.contentexcept:return ""def main():depth = 5infoList = []for i in range(depth):try:url = 'https://web-drcn.hispace.dbankcloud.cn/uowap/index?method=internal.user.commenList3&serviceType=20&reqPageNum='+str(i)+'&maxResults=25&appid=C10207269&version=10.0.0&zone=&locale=zh_CN'html = getHTMLText(url).decode("utf-8")result=json.loads(html) for i in range(len(result['list'])):#print(result['list'][i]['accountName'])comment = result['list'][i]['commentInfo']#print(comment)infoList.append(comment)#print(result)#parsePage(infoList, html)except:continue#printGoodsList(infoList)print(infoList)# 把评论数据保存到文件中with open('xuebajunComment.txt', 'a', encoding='utf-8') as f:f.write(json.dumps(infoList, ensure_ascii=False) + '\n')main()
代码说明:
对华为应用市场中 学霸君 APP的用户评论进行爬取
网址如下
https://web-drcn.hispace.dbankcloud.cn/uowap/index?method=internal.user.commenList3&serviceType=20&reqPageNum=1&maxResults=25&appid=C10207269&version=10.0.0&zone=&locale=zh_CN
python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论——学霸君相关推荐
- python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论——作业帮
python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论--作业帮 import requests import re import requests from bs4 import ...
- python3 爬虫数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云——小猿搜题
python3 爬虫&数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云--小猿搜题 # 导入扩展库 import re # 正则表达式库 import collections ...
- python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论——小猿搜题
python3 爬虫 爬取华为应用市场 APP应用评论(一)爬取全部评论--小猿搜题 import requests import re import requests from bs4 import ...
- python3 爬虫数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云——学霸君
python3 爬虫&数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云--学霸君 # 导入扩展库 import re # 正则表达式库 import collections # ...
- python3 爬虫数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云——作业帮
python3 爬虫&数据处理 爬取华为应用市场 APP应用评论(二)根据评论生成词云--作业帮 # 导入扩展库 import re # 正则表达式库 import collections # ...
- Python爬虫:爬取华为应用市场app数据
爬取华为应用商店的所有APP名称和介绍,因为页面数据是ajax异步加载的,所以要找到对应的接口去解析数据. 爬取华为应用市场app数据 一.分析网页 1. 分析主页 2. 分析appid 3. 分析u ...
- python3爬取华为应用市场APP安装包实战
** python3爬取华为应用市场APP安装包实战 ** 一.用浏览器访问华为应用市场,搜索APP并观察URL规律 比如我们要下载微信,那么在搜索框输入微信并回车,会发现url变成http://ap ...
- 爬虫学习(二)--爬取360应用市场app信息
欢迎加入python学习交流群 667279387 爬虫学习 爬虫学习(一)-爬取电影天堂下载链接 爬虫学习(二)–爬取360应用市场app信息 代码环境:windows10, python 3.5 ...
- python3爬虫系列03之requests库:根据关键词自动爬取下载百度图片
python3爬虫系列03之requests库:根据关键词自动爬取下载百度图片 1.前言 在上一篇文章urllib使用:根据关键词自动爬取下载百度图片 当中,我们已经分析过了百度图片的搜索URL的变化 ...
最新文章
- QuikNode高性能以太坊节点服务【详细指南】
- C++结构名、联合名、枚举名都是类型名
- TEG六周年 | 同心筑梦 共赢未来
- wordpress 文章页面 (single.php)
- mysql存储过程并行_Mysql存储过程的执行顺序问题
- Oracle dbms_random随机函数包
- (译)如何优化cocos2d程序的内存使用和程序大小:第二部分(完)
- MySQL数据库中如何使用rand随机查询记录
- 用for循环打印出九九乘法表
- CSS3渐变——gradient
- GetTickCount
- Linux入门的基础知识点
- Java调用dll文件
- QLineEdit屏蔽扫描枪输入自带回车的方法
- 图片裁剪,合成(设置透明背景)
- 报价单和价目表制作的软件app
- 用word2003打开.docx文件
- 数据库连接数和数据库连接池的连接数区别?
- 基于SpringBoot开发的企业OA自动化办公系统
- 工业触控一体机的特点和优势