资源简介
网易云评论的爬取,全部代码已经在压缩包里拉,大家自取

代码片段和文件信息
# -*- coding: utf-8 -*-
__author__ = “mendy“
import requests
import json
class Spider():
def __init__(self):
self.root_pattern = ‘‘
self.fromdata = {‘params‘:“OJi/RWqNbfxa4YK6UGm20cdvxu2WcYTCs861nLoI+5rICuyep1rotCRt/KcJ5Z+Iibc4x6ykWCIX9ITBDtii8Sz/FlTNIS4b5+JmaYMCaPPgLgqqvmseAVXLTUNR8dB51h9lvoO4NIrwCOuG+2qZFOdwzIhWxb+5ZV28QqiWYWxDA+ux2/O0Wd2zcDPo8/J4“
‘encSecKey‘:“bfac866fbfcdd86a16090ba4c5f080c4f0907f0dd6c0445c8d0ad432aaa0df6463908c4b94e11b26cdc7a38bfd710643c14b34eed631cee07122576837dbec497a81f60890765c78841721c47e22d236e821d24cda3e88b3fe6ede3a95634c22b71fecfcb8a68f190949d5c45fbf796aafb65c74abd57b62c06b277a2fcb06dc“}
self.header = {“User-Agent“:“Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/64.0.3282.168 Safari/537.36“}
self.url = ‘https://music.163.com/weapi/v1/resource/comments/R_SO_4_4878122?csrf_token=‘
def __get_jsons(selfurl):
jsons = requests.post(urldata=self.fromdataheaders=self.header)
print(jsons.status_code)
print (jsons.text)
print (json.loads(jsons.text))
print (jsons.json())
#requests中response.json()方法等同于json.loads(response.text)方法
num = 1
for user in jsons.json()[‘comments‘]:
print (“%d “%num)
print(user[“user“][“nickname“]+“:“+user[“content“]+“\t点赞数“+str(user[“likedCount“]))
num += 1
def run(self):
self.__get_jsons(self.url)
if __name__==“__main__“:
spider = Spider()
spider.run()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-22 16:18 wangyicloud_comment\
目录 0 2018-09-01 17:43 wangyicloud_comment\.idea\
目录 0 2018-06-22 16:18 wangyicloud_comment\.idea\inspectionProfiles\
文件 201 2018-06-22 16:28 wangyicloud_comment\.idea\misc.xm
文件 290 2018-06-22 16:08 wangyicloud_comment\.idea\modules.xm
文件 515 2018-06-22 16:28 wangyicloud_comment\.idea\wangyicloud_comment.iml
文件 13180 2018-09-01 17:43 wangyicloud_comment\.idea\workspace.xm
目录 0 2018-06-23 15:39 wangyicloud_comment\spider\
文件 1602 2018-06-23 15:39 wangyicloud_comment\spider\wangyispider.py
文件 45 2018-06-22 16:18 wangyicloud_comment\spider\__init__.py
目录 0 2018-06-22 16:09 wangyicloud_comment\venv\
目录 0 2018-05-16 19:19 wangyicloud_comment\venv\Include\
文件 46621 2017-02-13 22:37 wangyicloud_comment\venv\Include\abstract.h
文件 1144 2017-02-13 22:37 wangyicloud_comment\venv\Include\asdl.h
文件 243 2017-02-13 22:37 wangyicloud_comment\venv\Include\ast.h
文件 824 2017-02-13 22:37 wangyicloud_comment\venv\Include\bitset.h
文件 948 2017-02-13 22:37 wangyicloud_comment\venv\Include\boolob
文件 955 2017-02-13 22:37 wangyicloud_comment\venv\Include\bufferob
文件 1998 2017-02-13 22:37 wangyicloud_comment\venv\Include\bytearrayob
文件 1179 2017-02-13 22:37 wangyicloud_comment\venv\Include\bytesob
文件 2879 2017-02-13 22:37 wangyicloud_comment\venv\Include\bytes_methods.h
文件 679 2017-02-13 22:37 wangyicloud_comment\venv\Include\cellob
文件 5215 2017-08-26 23:47 wangyicloud_comment\venv\Include\ceval.h
文件 3085 2017-02-13 22:37 wangyicloud_comment\venv\Include\classob
文件 3019 2017-02-13 22:37 wangyicloud_comment\venv\Include\cob
文件 4519 2017-02-13 22:37 wangyicloud_comment\venv\Include\code.h
文件 6383 2017-02-13 22:37 wangyicloud_comment\venv\Include\codecs.h
文件 1105 2017-02-13 22:37 wangyicloud_comment\venv\Include\compile.h
文件 1919 2017-02-13 22:37 wangyicloud_comment\venv\Include\complexob
文件 2078 2017-02-13 22:37 wangyicloud_comment\venv\Include\cStringIO.h
文件 8552 2017-02-13 22:37 wangyicloud_comment\venv\Include\datetime.h
............此处省略2139个文件信息
- 上一篇:《中国人口增长预测模型》等.zip
- 下一篇:扩频通信手册——经典书籍收藏版
相关资源
- 随机森林R语言代码
- 计算机图形学 边填充算法实现代码
- 直流无刷电机方波驱动 stm32 例程代码
- 仿知乎界面小程序源代码
- 贪吃蛇源代码.fla
- 周立功开发板ProASIC3实验-syn_FIFO代码
- IMX385驱动代码.zip
- dotnet 写字板 实验 源代码 不好请要不
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- linux应用层的华容道游戏源代码
- 交通咨询模拟系统完整代码
- http请求状态代码
- 数值分析所有实验代码
- 网上拍卖系统完整源代码
- 音乐代码转换软件 单片机编程时用
- CSMA/CD等动画演示加源代码
- silicon lab公司的收音IC SI47XX全套开发工
- 用51单片机实现G代码翻译
- 合同管理系统的源代码(附数据库)
- 用VC 编写的仿QQ聊天室程序源代码
- web班级网站设计代码
- 38k单片机红外发送代码、keil
- STM32F103 串口程序(完整版)
- 网络唤醒代码
- VPC3_DPV1源代码,Profibus
- PB做的托盘程序(最小化后在左下角显
- RSA算法源码
- ubuntu9.10 可加载内核模块和字符设备驱
- 操作系统 LRU算法 实验报告 及 程序代
评论
共有 条评论