代码拉取完成,页面将自动刷新
#@Author : 逐鹿少年
#-*- codeing = utf-8 -*-
#@Time : 2020/10/01
#@File : JD.py
#@Sofaware : PyCharm
#https://bean.m.jd.com/
import pytz
import json
import time
import requests
import datetime
from io import StringIO
#获取Cookie,请先新建一个cookie.txt文件,并在文件内填入cookie
with open('cookie.txt', 'rt') as f:
cookies = f.read()
#填入token,不填则不会推送到微信
sckey ='SCU49417T9cd34e3ea9946df62765a549f19ab86d5cbd1a91e0c3d'
#日志配置
sio = StringIO('京东签到日志:\n\n')
sio.seek(0, 2)
dz = pytz.timezone('Asia/Shanghai')
nowtime = datetime.datetime.now(dz).strftime("%Y-%m-%d %H:%M:%S")
sio.write('------' + nowtime + '------')
#微信推送配置
def pushinfo(desp):
push_url = 'https://sc.ftqq.com/' + sckey + '.send'
if '已失效' in desp:
params = {
'text': 'Cookie失效',
'desp': desp
}
else:
params = {
'text': '京东签到提醒',
'desp': desp
}
requests.session().post(push_url, params)
#get
def geturl(url,refe):
header = {
'Cookie': cookies
}
if refe != None:
header["referer"] = refe
res = requests.get(url, headers=header).text
#res = json.loads(requests.get(url, data=data, headers=header))
#res = json.loads(res)
#info = res.text
return res
#post网页
def posturl(url,data,refe):
header = {
'Cookie': cookies
}
if refe != None:
header["referer"] = refe
res = requests.post(url, data=data, headers=header).text
return res
#验证登陆状态
def getlogin():
url = 'https://wq.jd.com/user/info/QueryJDUserInfo?sceneid=80027&_=1602147984799&sceneval=2&g_login_type='
#查京豆url https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean
#验证登录头加入 referer
'''
header = {
'referer': 'https://wqs.jd.com/my/jingdou/my.shtml',
'Cookie': cookies
}
'''
referer = 'https://wqs.jd.com/my/jingdou/my.shtml'
res = json.loads(geturl(url, referer))
state = res['msg']
if state == 'success.':
print('欢迎登陆 '+ res['base']['nickname'])
sio.write('\n\n==========欢迎用户 '+ res['base']['nickname'] +'==========\n\n')
return state
else:
print('当前cookie已失效')
#sio.write('\n\n==========cookie已失效==========\n\n')
return state
#京东商城-京豆签到
def JingDongBean():
#url = 'https://api.m.jd.com/client.action?functionId=findBeanIndex&appid=ld&client=m&clientVersion=null&networkType=unknown&osVersion=undefined&uuid=null'
#查询登录天数
url = 'https://api.m.jd.com/client.action?functionId=signBeanIndex&appid=ld'
res = json.loads(geturl(url, None))
#res1 = res['data']
#验证json下某一key是否存在:两种方法
#print(res1.__contains__("dailyAward"))
#if 'dailyAward' in res1.keys()
if 'dailyAward' in res['data'].keys():
# 单次签到 签到奖励豆数
daily = res['data']['dailyAward']['beanAward']['beanCount']
sio.write(f'\n\n京东商城-京豆: 成功, 明细: {daily} 京豆 💰 \n\n')
elif 'continuityAward' in res['data'].keys():
# 数连续签到 签到奖励豆
continuity = res['data']['continuityAward']['beanAward']['beanCount']
sio.write(f'\n\n京东商城-京豆: 成功, 明细: {continuity} 京豆 💰 \n\n')
else:
sio.write(f'\n\n京东商城-京豆: 失败, 原因: cookie失效 ⚠ \n\n')
#京东商城-转盘抽奖
def JingDongTurn():
url = 'https://api.m.jd.com/client.action?functionId=wheelSurfIndex&body={"actId":"jgpqtzjhvaoym","appSource":"jdhome"}&appid=ld'
res = json.loads(geturl(url, None))
code = res['data']['lotteryCode']
#print(res['data']['lotteryCount'])
'''
京东商城 - 转盘有奖励: {"code":"0","data":{"isWinner":"0","chances":"0","prizeType":"5","prizeId":"960604","prizeName":"1个京豆","prizeImage":"https://img30.360buyimg.com/activity/jfs/t1/130883/1/5394/14708/5f1f9976E3b2609b5/4e68aed524a92fd5.png","tips":"京豆1个","prizeSendNumber":"1"}}
京东商城 - 转盘无奖励: {"code":"0","data":{"isWinner":"1","chances":"0","toastTxt":"啊噢,未中奖~"}}
'''
if res['data']['lotteryCount'] == '1':
#未转盘,开始转盘 wupll7s766xme4p63iqis3e5z2olgso5cosvj7bm5cszrxjcj5rpe4lg4ba6nhb6hiawzpccizuck
url2 = 'https://api.m.jd.com/client.action?functionId=lotteryDraw&body={"actId":"jgpqtzjhvaoym","appSource":"jdhome","lotteryCode":"$'+code+'"}&appid=ld'
res2 = json.loads(geturl(url2,None))
if res2['data']['isWinner'] == '0':
print('京东商城-转盘:'+str(res2))
sio.write(f'\n\n京东商城-转盘: 成功, 明细: '+ res2['data']['prizeName'] +' 💰 \n\n')
else:
sio.write(f'\n\n京东商城-转盘: 成功, 明细: ' + res2['data']['toastTxt'] + ' 💰 \n\n')
else:
#已经转盘得到结果
#print('京东商城-转盘: 失败, 原因: 已转过 ⚠')
sio.write(f'\n\n京东商城-转盘: 失败, 原因: 已转过 ⚠ \n\n')
#京东商城-摇一摇
def JingDongShake():
#查询剩余次数
url = 'https://api.m.jd.com/client.action?appid=vip_h5&functionId=vvipclub_luckyBox&body={"info":"freeTimes,title,beanNum,useBeanNum,imgUrl"}'
res = json.loads(geturl(url, None))
n = res['data']['freeTimes']
#print(res)
while n > 0:
#if res['data']['freeTimes'] > 0:
url1 = 'https://api.m.jd.com/client.action?appid=vip_h5&functionId=vvipclub_shaking&body={"type":"0","riskInfo":{"platform":1,"pageClickKey":"MJDVip_Shake","eid":"F5SHMR4IY33LMXBJO5E3UPPSNFWCFZ3CAUJ5LVDIIKLDP42FIL2XKQQZZB6WN7ABPGR7ZNRRYLGQ3S6JTDY7RKG2EU","fp":"3100680416ad5ade4c2d199af936da61","shshshfp":"2bb8c811624129ffef6831368a9ba784","shshshfpa":"295592c4-7280-1d9d-e9fb-502e8322cce7-1573122749","shshshfpb":"dPBiy3eH5ttgYmlspRhNPnA=="}}'
res1 = json.loads(geturl(url1, None))
print(res1)
n = n-1
print('剩余' + str(res1['data']['luckyBox']['freeTimes']) + '次')
if 'prizeBean' in res1['data'].keys():
sio.write(f'\n\n京东商城-摇一摇: 成功, 明细: ' + str(res1['data']['prizeBean']['count']) + ' 💰 \n\n')
else:
quota = res1['data']['prizeCoupon']['quota']
discount = res1['data']['prizeCoupon']['discount']
sio.write(f'\n\n京东商城-摇一摇: 成功, 明细: 优惠券:' + str(quota) + '-' + str(discount) + ' 💰 \n\n')
#{"data": {"luckyBox": {"costBeanCount": "2", "feeTimes": "2", "freeTimes": "1", "totalBeanCount": "4856"}, "prizeBean": {"count": "5"}}, "success": "True"}
#else:
#print("京东商城-摇摇: 失败, 原因: 已经没有次数")
sio.write(f'\n\n京东商城-摇摇: 失败, 原因: 已经没有次数 ⚠️\n\n')
#京东商城-国际
def JDOverseas():
url = 'https://api.m.jd.com/client.action?functionId=checkin&body=%7B%7D&build=167237&client=apple&clientVersion=9.0.0&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&partner=apple&scope=11&sign=e27f8b904040a0e3c99b87fc27e09c87&st=1591730990449&sv=101'
res = json.loads(geturl(url, None))
#print(res)
'''
{"result":{"type":1,"rewardDesc":"连签30天有惊喜哦~","checkinMsg":"京豆将在24小时内发放至账户","checkinTitle":"签到成功","jumpUrl":"https://pro.m.jd.com/mall/active/3YvKJrc4e4WK7aZ46j3h5UMCvEn4/index.html","jumpName":"去逛国际优品","consecutiveSignDays":1,"jdBeanAmount":1},"code":"0","success":true}
'''
if 'jdBeanAmount' in res['result'].keys():
sio.write(f'\n\n京东商城-国际: 成功, 明细: ' + str(res['result']['jdBeanAmount']) + ' 京豆 🐶 \n\n')
else:
sio.write(f'\n\n京东商城-国际: 失败, 原因: 已签过 ⚠ \n\n')
#京东现金-红包
def JingDongCash():
url = 'https://api.m.jd.com/client.action?functionId=ccSignInNew&body=%7B%22pageClickKey%22%3A%22CouponCenter%22%2C%22eid%22%3A%22O5X6JYMZTXIEX4VBCBWEM5PTIZV6HXH7M3AI75EABM5GBZYVQKRGQJ5A2PPO5PSELSRMI72SYF4KTCB4NIU6AZQ3O6C3J7ZVEP3RVDFEBKVN2RER2GTQ%22%2C%22shshshfpb%22%3A%22v1%5C%2FzMYRjEWKgYe%2BUiNwEvaVlrHBQGVwqLx4CsS9PH1s0s0Vs9AWk%2B7vr9KSHh3BQd5NTukznDTZnd75xHzonHnw%3D%3D%22%2C%22childActivityUrl%22%3A%22openapp.jdmobile%253a%252f%252fvirtual%253fparams%253d%257b%255c%2522category%255c%2522%253a%255c%2522jump%255c%2522%252c%255c%2522des%255c%2522%253a%255c%2522couponCenter%255c%2522%257d%22%2C%22monitorSource%22%3A%22cc_sign_ios_index_config%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&d_model=iPhone8%2C2&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&scope=11&screen=1242%2A2208&sign=1cce8f76d53fc6093b45a466e93044da&st=1581084035269&sv=102'
res = json.loads(geturl(url, None))
#print(res)
#{"code":"0","success":true,"busiCode":"1002","message":"大人,您今天已经完成签到了哦~请明天再来吧~","result":{"signResult":{"msg":"大人,您今天已经完成签到了哦~请明天再来吧~","showCode":"2","bizCode":"1002","errCode":null,"signData":null,"success":false}}}
#{"code":"0","success":true,"busiCode":"0","message":"成功","result":{"signResult":{"msg":"成功","showCode":"0","bizCode":"0","errCode":null,"signData":{"id":3,"signRate":"1","ynSign":"1","amount":"0.08","subTitle":"连签7天瓜分100万","hbActId":31896,"signDetail":[{"signRate":"1","ynSign":"1","amount":"0.08","iconText":"","popText":"明天赢千份8.8红包","iconImg":null},{"signRate":"2","ynSign":"0","amount":null,"iconText":"千份8.8","popText":"明天赢最高88元红包","iconImg":null},{"signRate":"3","ynSign":"0","amount":null,"iconText":"最高88","popText":"再签2天红包金额升级","iconImg":null},{"signRate":"4","ynSign":"0","amount":null,"iconText":"","popText":"明天签到红包金额升级","iconImg":null},{"signRate":"5","ynSign":"0","amount":null,"iconText":"金额升级","popText":"再签2天瓜分100万","iconImg":null},{"signRate":"6","ynSign":"0","amount":null,"iconText":"","popText":"明天瓜分100万红包","iconImg":null},{"signRate":"7","ynSign":"0","amount":null,"iconText":"分100万","popText":"明日继续签到领红包","iconImg":"https://m.360buyimg.com/njmobilecms/jfs/t1/88571/6/17500/14934/5e869bd3Efa9de0a0/6be7ed6235cfa383.png"}]},"success":true}}}
if res['busiCode'] == '0':
amount = res['result']['signResult']['signData']['amount']
sio.write(f'\n\n京东现金-红包: 成功, 明细: ${amount}红包 🧧\n\n')
else:
sio.write(f'\n\n京东现金-红包: 失败, 原因: 今日已经签到 ⚠️\n\n')
#京东现金-魔方 未测试
def JingDongCash111():
url = 'https://api.m.jd.com/client.action?functionId=ccSignInNew&body=%7B%22pageClickKey%22%3A%22CouponCenter%22%2C%22eid%22%3A%22O5X6JYMZTXIEX4VBCBWEM5PTIZV6HXH7M3AI75EABM5GBZYVQKRGQJ5A2PPO5PSELSRMI72SYF4KTCB4NIU6AZQ3O6C3J7ZVEP3RVDFEBKVN2RER2GTQ%22%2C%22shshshfpb%22%3A%22v1%5C%2FzMYRjEWKgYe%2BUiNwEvaVlrHBQGVwqLx4CsS9PH1s0s0Vs9AWk%2B7vr9KSHh3BQd5NTukznDTZnd75xHzonHnw%3D%3D%22%2C%22childActivityUrl%22%3A%22openapp.jdmobile%253a%252f%252fvirtual%253fparams%253d%257b%255c%2522category%255c%2522%253a%255c%2522jump%255c%2522%252c%255c%2522des%255c%2522%253a%255c%2522couponCenter%255c%2522%257d%22%2C%22monitorSource%22%3A%22cc_sign_ios_index_config%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&d_model=iPhone8%2C2&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&scope=11&screen=1242%2A2208&sign=1cce8f76d53fc6093b45a466e93044da&st=1581084035269&sv=102'
res = json.loads(geturl(url, None))
#print(res)
#{"code":"0","success":true,"busiCode":"1002","message":"大人,您今天已经完成签到了哦~请明天再来吧~","result":{"signResult":{"msg":"大人,您今天已经完成签到了哦~请明天再来吧~","showCode":"2","bizCode":"1002","errCode":null,"signData":null,"success":false}}}
#{"code":"0","success":true,"busiCode":"0","message":"成功","result":{"signResult":{"msg":"成功","showCode":"0","bizCode":"0","errCode":null,"signData":{"id":3,"signRate":"1","ynSign":"1","amount":"0.08","subTitle":"连签7天瓜分100万","hbActId":31896,"signDetail":[{"signRate":"1","ynSign":"1","amount":"0.08","iconText":"","popText":"明天赢千份8.8红包","iconImg":null},{"signRate":"2","ynSign":"0","amount":null,"iconText":"千份8.8","popText":"明天赢最高88元红包","iconImg":null},{"signRate":"3","ynSign":"0","amount":null,"iconText":"最高88","popText":"再签2天红包金额升级","iconImg":null},{"signRate":"4","ynSign":"0","amount":null,"iconText":"","popText":"明天签到红包金额升级","iconImg":null},{"signRate":"5","ynSign":"0","amount":null,"iconText":"金额升级","popText":"再签2天瓜分100万","iconImg":null},{"signRate":"6","ynSign":"0","amount":null,"iconText":"","popText":"明天瓜分100万红包","iconImg":null},{"signRate":"7","ynSign":"0","amount":null,"iconText":"分100万","popText":"明日继续签到领红包","iconImg":"https://m.360buyimg.com/njmobilecms/jfs/t1/88571/6/17500/14934/5e869bd3Efa9de0a0/6be7ed6235cfa383.png"}]},"success":true}}}
if res['busiCode'] == '0':
amount = res['result']['signResult']['signData']['amount']
sio.write(f'\n\n京东现金-红包: 成功, 明细: ${amount}红包 🧧\n\n')
else:
sio.write(f'\n\n京东金融-金贴: 失败, 原因: 今日已经签到 ⚠️\n\n')
#url: `https://api.m.jd.com/client.action?functionId=getNewsInteractionLotteryInfo&appid=smfe${id ? `&body=%7B%22interactionId%22%3A${id}%7D` : ``}`
#京东商城-大奖
#https://jdmall.m.jd.com/beansForPrizes
def JingDongPrize():
url = 'https://api.m.jd.com/client.action?functionId=vvipscdp_raffleAct_index&client=apple&clientVersion=8.1.0&appid=member_benefit_m'
header = 'https://jdmall.m.jd.com/beansForPrizes'
res = json.loads(geturl(url, header))
#print(res)
if res['data']['floorInfoList'][0]['detail']['freeTimes'] == 1:
raffleActKey = res ['data']['floorInfoList'][0]['detail']['raffleActKey']
url1 = 'https://api.m.jd.com/client.action?functionId=vvipscdp_raffleAct_lotteryDraw&body=%7B%22raffleActKey%22%3A%22'+raffleActKey+'%22%2C%22drawType%22%3A0%2C%22riskInformation%22%3A%7B%22platform%22%3A%223%22%2C%22orgType%22%3A%222%22%2C%22jda%22%3A%22-1%22%2C%22client%22%3A%22web%22%2C%22country%22%3A%22%22%2C%22language%22%3A%22%22%2C%22childActivityId%22%3A%22%22%2C%22childActiveName%22%3A%22%22%2C%22childActivityTime%22%3A%22%22%2C%22childActivityUrl%22%3A%22%22%2C%22openId%22%3A%22%22%2C%22activityArea%22%3A%22%22%2C%22applicantErp%22%3A%22%22%2C%22clientIp%22%3A%22%22%2C%22eid%22%3A%22%22%2C%22fp%22%3A%22%22%2C%22shshshfp%22%3A%22%22%2C%22shshshfpa%22%3A%22%22%2C%22shshshfpb%22%3A%22%22%2C%22clientVersion%22%3A%22%22%2C%22uuid%22%3A%22%22%2C%22osVersion%22%3A%22%22%2C%22brand%22%3A%22%22%2C%22model%22%3A%22%22%2C%22networkType%22%3A%22%22%2C%22referUrl%22%3A%22%22%2C%22userAgent%22%3A%22%22%2C%22activityType%22%3A%22%22%2C%22isRvc%22%3A%22%22%2C%22pageClickKey%22%3A%22%22%2C%22userArea%22%3A%22%22%7D%2C%22paramData%22%3A%7B%22document_business%22%3A%22vvipscdp%22%2C%22document_channel%22%3A2%2C%22channelType%22%3A1%7D%2C%22memberBenefitsVersion%22%3A%221.4%22%7D&client=apple&clientVersion=8.1.0&appid=member_benefit_m&jsonp=jsonp_1604779265424_76001'
res1 = json.loads(geturl(url1, header))
print('还有次数')
sio.write(f'\n\n京东现金-大奖: 成功, 明细: $红包 🧧\n\n')
else:
sio.write(f'\n\n京东金融-大奖: 失败, 原因: 今日已经签到 ⚠️\n\n')
print('没有次数')
#京东-种豆得豆-种豆任务列表
def JingDongDOU():
url = 'https://api.m.jd.com/client.action?functionId=plantBeanIndex&body={"monitor_source":"plant_m_plant_index","monitor_refer":"","version":"9.0.0.4"}&appid=ld&client=apple'
res = json.loads(geturl(url, None))
bubble = res['data']['roundList'][1]['bubbleInfos'] # 查询水滴气泡数
bubbleInfos = [] # 定义一个数组
a = 0
while a < len(bubble): #取完成任务数组
bubbleInfos.append(str(res['data']['roundList'][1]['bubbleInfos'][a]['nutrientsType'])) # 查询第一个水滴气泡id
a = a + 1
#print(bubbleInfos) #输出水滴id
taskList = res['data']['taskList'] #任务列表数
print('总任务数:'+str(len(taskList))) #输出需要完成任务数量
a = 0
while a < len(taskList):
#time.sleep(2)
taskType = res['data']['taskList'][a]['taskType']
btnTxt = res['data']['taskList'][a]['btnTxt']
print('任务编号:'+ str(taskType) +' 任务状态:'+ btnTxt)
if btnTxt != '已完成':
# 1 == 每日签到;4 == 逛逛会场;40 == 食品饮料;18 == 1元包邮;36 == 免费水果;39 == 城城分现金
#if str(taskType) not in bubbleInfos:
if taskType == 1:
print('每日签到')
elif taskType == 3:
totalNum = res['data']['taskList'][a]['totalNum']
gainedNum = res['data']['taskList'][a]['gainedNum']
print('浏览店铺完成状态 :' + gainedNum + '/' + totalNum)
sio.write(f'\n\n种豆得豆-浏览店铺完成状态: ' + gainedNum + '/' + totalNum + '️\n\n')
JDZhongDOU2(totalNum, gainedNum)
elif taskType == 10:
totalNum = res['data']['taskList'][a]['totalNum']
gainedNum = res['data']['taskList'][a]['gainedNum']
print('关注频道完成状态 :' + gainedNum + '/' + totalNum)
sio.write(f'\n\n种豆得豆-关注频道完成状态: ' + gainedNum + '/' + totalNum + '️\n\n')
JDZhongDOU3(totalNum, gainedNum)
elif taskType == 5:
totalNum = res['data']['taskList'][a]['totalNum']
gainedNum = res['data']['taskList'][a]['gainedNum']
print('挑选商品完成状态 :' + gainedNum + '/' + totalNum)
sio.write(f'\n\n种豆得豆-挑选商品完成状态: ' + gainedNum + '/' + totalNum + '️\n\n')
JDZhongDOU4(totalNum, gainedNum)
else:
taskname = res['data']['taskList'][a]['taskName']
print('正在完成:'+ taskname)
JDZhongDOU1(taskType,taskname)
else:
#print('任务已完成')
sio.write(f'\n\n种豆得豆-任务状态: 任务已完成️\n\n')
a = a + 1
time.sleep(2)
#print('所有已完成')
sio.write(f'\n\n种豆得豆-任务列表: 结束, 原因: 全部任务已完成 ⚠ \n\n')
JDZhongDOU0()
#京东-种豆-收取营养液
def JDZhongDOU0():
url = 'https://api.m.jd.com/client.action?functionId=plantBeanIndex&body={"monitor_source":"plant_m_plant_index","monitor_refer":"","version":"9.0.0.4"}&appid=ld&client=apple'
res = json.loads(geturl(url, None))
roundId = res['data']['roundList'][1]['roundId'] # 必须! 取出roundId
#print(roundId)
code = res['data']['roundList'][1]['bubbleInfos'] # 多少个可以收取的营养液
code = json.loads(json.dumps(code))
#print(code) #输出多少个可以收取的营养液
if len(code) != 0 :
count = 0 # 次数置零
while (count != len(code)) :
nutrientsType = res['data']['roundList'][1]['bubbleInfos'][count]['nutrientsType'] #取出nutrientsType
url = 'https://api.m.jd.com/client.action?functionId=cultureBean&body={"roundId":"' + roundId + '","nutrientsType":"'+ nutrientsType +'","monitor_source":"plant_m_plant_index","monitor_refer":"plant_index","version":"9.0.0.4"}&appid=ld&client=apple'
res1 = geturl(url, None)
res1 = json.loads(res1)
#print(nutrientsType)
if ('data' in res1) :
code1 = res1['data']['beanState']
#print('已收取营养液:' + code1)
sio.write(f'\n\n种豆得豆-收营养液: 成功, 明细: 收取营养液'+ res1['data']['beanState'] +' ⚠ \n\n')
count = count + 1
time.sleep(2)
#print('营养液已经收取完')
sio.write(f'\n\n种豆得豆-收营养液: 结束, 原因: 全部营养液已收取完 ⚠ \n\n')
else:
#print('没有可收')
sio.write(f'\n\n种豆得豆-收营养液: 结束, 原因: 已没有可收营养液 ⚠ \n\n')
#京东-种豆-通用任务方式
def JDZhongDOU1(num,taskname):
url = 'https://api.m.jd.com/client.action?functionId=receiveNutrientsTask&body={"awardType":"' + str(num) + '","monitor_source":"plant_m_plant_index","monitor_refer":"plant_receiveNutrientsTask","version":"9.0.0.4"}&appid=ld&client=apple'
res = json.loads(geturl(url, None))
code = res['data']['nutrNum']
#print(code)
if code == 1:
#print('成功获得营养液')
sio.write(f'\n\n种豆得豆-通用任务: '+taskname+'完成 , 成功获得营养液 ⚠ \n\n')
#京东-种豆-浏览店铺任务
def JDZhongDOU2(totalNum,gainedNum):
url = 'https://api.m.jd.com/client.action?functionId=shopTaskList&body={"monitor_source":"plant_m_plant_index","monitor_refer":"plant_shopList","version":"9.0.0.4"}&appid=ld'
res = json.loads(geturl(url, None))
num = int(totalNum) - int(gainedNum) #计算剩余次数
a = 0
b = 0
while b < num:
shopTaskId = res['data']['moreShopList'][a]['shopTaskId']
shopId = res['data']['moreShopList'][a]['shopId']
url1 = 'https://api.m.jd.com/client.action?functionId=shopNutrientsTask&body={"shopTaskId":"'+shopTaskId+'","shopId":"'+shopId+'","monitor_source":"plant_m_plant_index","monitor_refer":"plant_shopNutrientsTask","version":"9.0.0.4"}&appid=ld'
res1 = json.loads(geturl(url1, None))
#print(res1) #{"code":"0","data":{"nutrState":"3"}}
if res1['data']['nutrState'] == '1':
#print('关注成功,获得1瓶营养液')
sio.write(f'\n\n京东商城-种豆-浏览店铺任务: 成功, 明细: 获得1瓶营养液 ⚠ \n\n')
b = b + 1
elif b == 4:
continue
a = a + 1
time.sleep(4)
#京东-种豆-关注频道任务
def JDZhongDOU3(totalNum,gainedNum):
url = 'https://api.m.jd.com/client.action?functionId=plantChannelTaskList&body={}&appid=ld'
res = json.loads(geturl(url, None))
num = int(totalNum) - int(gainedNum)
a = 0
b = 0
while b < num:
channelTaskId = res['data']['normalChannelList'][a]['channelTaskId']
channelId = res['data']['normalChannelList'][a]['channelId']
url1 = 'https://api.m.jd.com/client.action?functionId=plantChannelNutrientsTask&body={"channelTaskId":"'+str(channelTaskId)+'","channelId":"'+str(channelId)+'"}&uuid=16023137222221788117012&appid=ld'
res1 = json.loads(geturl(url1, None))
print(res1)
print(a)
if res1['data']['nutrState'] == '1':
print('关注成功,获得1瓶营养液')
sio.write(f'\n\n京东商城-种豆-关注商品任务: 成功, 明细: 获得1瓶营养液 ⚠ \n\n')
b = b + 1
elif b == 3:
continue
a = a + 1
time.sleep(4)
#京东-种豆-挑选商品任务
def JDZhongDOU4(totalNum,gainedNum):
url = 'https://api.m.jd.com/client.action?functionId=productTaskList&body={"monitor_source":"plant_m_plant_index","monitor_refer":"plant_productTaskList","version":"9.0.0.4"}&appid=ld'
res = json.loads(geturl(url, None))
num = int(totalNum) - int(gainedNum)
a = 0
b = 0
while b < num:
productTaskId = res['data']['productInfoList'][a][0]['productTaskId']
skuId = res['data']['productInfoList'][a][0]['skuId']
state = res['data']['productInfoList'][a][0]['taskState']
#print(state +' productTaskId ' +productTaskId + ' skuId ' + skuId) #打印关注状态+店铺id+商品id
a = a + 1
if state == '2':
url1 = 'https://api.m.jd.com/client.action?functionId=productNutrientsTask&body={"productTaskId":"' + str(productTaskId) + '","skuId":"' + str(skuId) + '","monitor_source":"plant_m_plant_index","monitor_refer":"plant_productNutrientsTask","version":"9.0.0.4"}&appid=ld&client=apple'
res1 = geturl(url1, None)
res1 = json.loads(res1)
#print(res1) #打印点击关注返回 #{"code":"0","data":{"nutrState":"1","followState":"1","nutrToast":"关注成功,获得1瓶营养液","nutrCount":"1"}}
if res1['data']['nutrState'] == '1':
b = b + 1
#print('关注成功,获得1瓶营养液')
sio.write(f'\n\n京东商城-种豆-关注商品任务: 成功, 明细: 获得1瓶营养液 ⚠ \n\n')
time.sleep(4)
#京东金融-金贴
def JingRongBean():
url = 'https://ms.jr.jd.com/gw/generic/zc/h5/m/queryOpenScreenReward'
params = {'reqData': '{"channelCode":"ZHUANQIAN","clientType":"sms","clientVersion":"11.0"}'}
header = 'https://active.jd.com/forever/cashback/index'
res = json.loads(posturl(url, params, header))
code = res['resultData']['data']['rewardAmount']
#false = False
if res['resultData']['data']['reward'] == False:
url1 = 'https://ms.jr.jd.com/gw/generic/zc/h5/m/openScreenReward'
res1 = json.loads(posturl(url1, params, header))
if res1['resultData']['data']['rewardCode'] == '00000':
#print('京东金融-金贴: 成功, 明细: ' + code + '金贴 💰')
sio.write(f'\n\n京东商城-金贴: 成功, 明细: ' + str(code) + '金贴 💰 \n\n')
else:
#print('京东金融-金贴: 失败, 原因: ' + res1['resultMsg'])
sio.write(f'\n\n京东金融-金贴: 失败, 原因: '+ res1['resultMsg'] +'⚠️\n\n')
else:
#print('京东金融-金贴: 失败, 原因: 已签过⚠️')
sio.write(f'\n\n京东金融-金贴: 失败, 原因: 已签过⚠️\n\n')
#京东金融-钢镚
#https://member.jr.jd.com/activities/sign/v5/indexV2.html?channel=gry&jrcontainer=h5&jrlogin=true&sid=c86b2596d778ef5644c3169af4d8fddw&utm_term=qqfriends&utm_source=iOS*url*1604785537105&utm_medium=jrappshare
def JingRongSteel():
url = 'https://ms.jr.jd.com/gw/generic/gry/h5/m/signIn?reqData=%7B%22channelSource%22%3A%22JRAPP%22%2C%22riskDeviceParam%22%3A%22%7B%7D%22%7D'
res = json.loads(geturl(url, None))
#print(res)
#{"resultCode":0,"resultMsg":"操作成功","resultData":{"resBusiData":{"actualTotalRewardsValue":1,"receiveBasicReward":{"activityId":"1906508","rewardName":"钢镚","rewardId":"3359","multipleValue":1,"rewardType":1,"basicValue":1,"id":7,"actualBasicRewardsValue":1,"weekendValue":0},"continuityDays":1,"identity":"identity5"},"resBusiMsg":"操作成功","resBusiCode":0},"channelEncrypt":0}
#{"resultCode":0,"resultMsg":"操作成功","resultData":{"resBusiMsg":"已经领取过","resBusiCode":15},"channelEncrypt":0}
# resBusiCode=0 未签到 resBusiCode=15 已签到
if res['resultData']['resBusiCode'] == '0':
code = res['resultData']["resBusiData"]['actualTotalRewardsValue']
#print('京东金融-钢镚:成功, 明细: ' + code + '钢镚 💰')
sio.write(f'\n\n京东商城-钢镚: 成功, 明细: ' + code + '钢镚 💰 \n\n')
elif res['resultData']['resBusiCode'] == '15':
#print('京东金融-钢镚:失败, 原因: 已签过 ⚠️')
sio.write(f'\n\n京东金融-钢镚:失败, 原因: 已签过 ⚠️\n\n')
elif res['resultData']['resBusiCode'] == '5':
#print('京东金融-钢镚:失败, 原因: '+res['resultData']['resBusiMsg']+' ⚠️')
sio.write(f'\n\n京东金融-钢镚: 失败, 原因: '+res['resultData']['resBusiMsg']+' ⚠️\n\n')
else:
#print('京东金融-钢镚:失败, 原因: '+res['resultData']['resBusiMsg']+'⚠️')
sio.write(f'\n\n京东金融-钢镚: 失败, 原因: ' + res['resultData']['resBusiMsg'] + ' ⚠️\n\n')
#京东金融-双签
def JRDoubleSign():
url = 'https://nu.jr.jd.com/gw/generic/jrm/h5/m/process?'
datas = {'reqData': '{"actCode":"FBBFEC496C","type":3,"riskDeviceParam":""}'}
res = json.loads(posturl(url, datas, None))
#res = requests.post(url, data=datas, headers=header,allow_redirects=False)
#print(res)
if res['resultData']['data']['businessData']['businessCode'] == '000sq':
code = res ['resultData']['data']['businessData']['businessData']['awardListVo'][0]['count']
sio.write(f'\n\n京东商城-双签: 成功, 明细: ' + str(code) + '京豆 🐶 \n\n')
elif res['resultData']['data']['businessData']['businessCode'] == '300sq':
sio.write(f'\n\n京东商城-双签: 失败, 原因: 当天已领取 ⚠ \n\n')
elif res['resultData']['data']['businessData']['businessCode'] == '302sq':
sio.write(f'\n\n京东商城-双签: 失败, 原因: 未在京东app签到 ⚠ \n\n')
else:
sio.write(f'\n\n京东商城-双签: 失败, 原因: 异常 ⚠ \n\n')
def main(*args):
state = getlogin()
if 'success' in state :
JingDongBean() ##京东商城-京豆签到
JingDongTurn() #京东商城-转盘抽奖
JingDongShake() #京东商城-摇一摇
JingRongBean() #京东金融-金贴 √
JingRongSteel() #京东金融-钢镚
JRDoubleSign() #京东金融-双签
JingDongCash() #京东现金-红包
JDOverseas() #京东商城-国际
#JingDongPrize() #京东商城-大奖
JingDongDOU() #京东-种豆得豆
else :
sio.write('\n\n==========cookie已失效2==========\n\n')
desp = sio.getvalue()
if sckey != '':
pushinfo(desp)
else:
print('未推送')
print(desp)
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。