def historyData():
h_data_list = []
for i in range(1, 81): # for循环,一共81页;
url = 'https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=30&isVerify=1&pageNo=%s' % i
# print(url)
# html = get_url(url) # 请求url获取返回代码
historydata = requests.get(url).json()
historydata_list = historydata['value']['list']
# print(historydata_list)
for j in historydata_list:
lotteryDrawNum = j["lotteryDrawNum"]
lotteryDrawResult = j["lotteryDrawResult"]
lotteryDrawTime = j["lotteryDrawTime"]
h_data_list.append([lotteryDrawNum, lotteryDrawResult, lotteryDrawTime])
# print(lotteryDrawNum,":",lotteryDrawResult,":",lotteryDrawTime)
# print(h_data_list)
h_data_list = sorted(h_data_list, key=lambda x: x[0]) # 从小到大排序
print(h_data_list)
if __name__ == '__main__':
historyData()
image.png (65.46 KB, 下载次数: 0)
下载附件
2023-3-25 11:43 上传