mirror of https://github.com/KingRan/KR.git
parent
aef1de456d
commit
268fa8c563
44
jd_btdraw.py
44
jd_btdraw.py
|
@ -113,6 +113,41 @@ def geteid(a,d):
|
|||
response=requests.post(url=url,headers=headers,data=data)
|
||||
return response.text
|
||||
|
||||
def getactivityid(ck):
|
||||
homepageurl='https://ms.jr.jd.com/gw/generic/bt/h5/m/btJrFirstScreen'
|
||||
data='reqData={"environment":"2","clientType":"ios","clientVersion":"6.2.60"}'
|
||||
try:
|
||||
headers={
|
||||
'Host':'ms.jr.jd.com',
|
||||
'Content-Type':'application/x-www-form-urlencoded',
|
||||
'Origin':'https://mcr.jd.com',
|
||||
'Accept-Encoding':'gzip, deflate, br',
|
||||
'Cookie':ck,
|
||||
'Connection':'keep-alive',
|
||||
'Accept':'application/json, text/plain, */*',
|
||||
'User-Agent':UserAgent,
|
||||
'Referer':'https://mcr.jd.com/',
|
||||
'Content-Length':'71',
|
||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9'
|
||||
}
|
||||
homepageresponse=requests.post(url=homepageurl,headers=headers,data=data)
|
||||
for i in range(len(json.loads(homepageresponse.text)['resultData']['data']['activity']['data']['couponsRight'])):
|
||||
if json.loads(homepageresponse.text)['resultData']['data']['activity']['data']['couponsRight'][i]['resName'].find('天天试手气')!=-1:
|
||||
activityurl=json.loads(homepageresponse.text)['resultData']['data']['activity']['data']['couponsRight'][i]['jumpUrl']['jumpUrl']+'&jrcontainer=h5&jrlogin=true&jrcloseweb=false'
|
||||
break
|
||||
htmlheaders={
|
||||
'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'user-agent':UserAgent,
|
||||
'accept-language':'zh-CN,zh-Hans;q=0.9',
|
||||
'accept-encoding':'gzip, deflate, br'
|
||||
}
|
||||
activityhtml=requests.get(url=activityurl,headers=htmlheaders)
|
||||
activityid=re.search(r"activityId=.{28}",activityhtml.text,re.M|re.I).group().replace('activityId=','')
|
||||
print('活动id:'+activityid)
|
||||
return activityid
|
||||
except:
|
||||
printf('获取活动id失败,程序即将退出')
|
||||
os._exit(0)
|
||||
def draw(activityid,eid,fp):
|
||||
global sendNotifyflag
|
||||
global prizeAward
|
||||
|
@ -130,7 +165,7 @@ def draw(activityid,eid,fp):
|
|||
'Origin':'https://jrmkt.jd.com',
|
||||
'User-Agent':UserAgent,
|
||||
'Connection':'keep-alive',
|
||||
'Referer':'https://jrmkt.jd.com/ptp/wl/vouchers.html?activityId=Q029794F612c2E2O1D2a0N161v0Z2i2s9nJ&jrcontainer=h5&jrlogin=true&jrcloseweb=false',
|
||||
'Referer':'https://ms.jr.jd.com/gw/generic/bt/h5/m/btJrFirstScreen',
|
||||
'Content-Length':str(len(data)),
|
||||
'Cookie':ck
|
||||
}
|
||||
|
@ -147,14 +182,17 @@ def draw(activityid,eid,fp):
|
|||
except:
|
||||
printf('出错啦,出错原因为:'+json.loads(response.text)['failDesc']+'\n\n')
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(5)
|
||||
|
||||
if __name__ == '__main__':
|
||||
printf('游戏入口:京东金融-白条-天天试手气\n')
|
||||
remarkinfos={}
|
||||
get_remarkinfo()
|
||||
UserAgent=randomuserAgent()
|
||||
try:
|
||||
cks = os.environ["JD_COOKIE"].split("&")
|
||||
UserAgent=randomuserAgent()
|
||||
activityid=getactivityid(cks[0])
|
||||
except:
|
||||
f = open("/jd/config/config.sh", "r", encoding='utf-8')
|
||||
cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
|
||||
|
@ -175,6 +213,6 @@ if __name__ == '__main__':
|
|||
info=JDSignValidator('https://prodev.m.jd.com/mall/active/498THTs5KGNqK5nEaingGsKEi6Ao/index.html')
|
||||
eid=json.loads(geteid(info[1],info[2]).split('_*')[1])['eid']
|
||||
fp=info[0]
|
||||
draw('a9O2k2U042U208160626503920Q3',eid,fp)
|
||||
draw(activityid,eid,fp)
|
||||
if sendNotifyflag:
|
||||
send('京东白条抽奖通知',username+'抽到'+str(prizeAward)+'的优惠券了,速去京东金融-白条-天天试手气查看')
|
Loading…
Reference in New Issue