python+Fiddler爬取某音评论

#-*-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')

python+Fiddler爬取某音评论_第1张图片
我v:yummoo

你可能感兴趣的:(python,python,fiddler,开发语言)