python+Fiddler爬取某音评论
python+fiddler自动爬取某音评论和id
·
#-*-coding:utf-8-*-
import requests
import json
file = 'Sessions.dat'
with open(file,encoding='utf-16') as f:
lines = f.readlines()
len=len(lines)
with open('comments831.txt','a') as file:
for i in range(0, len): # range防止下标越界
try:
comm = json.loads(lines[i])
for j in range(100):
print(j,comm['response_data']['comments'][j]['text'])
print(comm['response_data']['comments'][j]['user']['short_id'])
file.write(comm['response_data']['comments'][j]['text']+'\n')
file.write(comm['response_data']['comments'][j]['user']['short_id']+'\n')
我v:yummoo
更多推荐
所有评论(0)