mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
11
This commit is contained in:
parent
c5ebb7951c
commit
915bc813c9
408
jd_fcwb.py
408
jd_fcwb.py
@ -1,408 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
cron: 1 1 1 1 *
|
||||
new Env('发财挖宝');
|
||||
活动入口: 京东极速版 > 我的 > 发财挖宝
|
||||
最高可得总和为10元的微信零钱和红包
|
||||
脚本功能为: 挖宝,提现,没有助力功能,当血量剩余 1 时停止挖宝,领取奖励并提现
|
||||
|
||||
目前需要完成逛一逛任务并且下单任务才能通关,不做的话大概可得1.5~2块的微信零钱
|
||||
'''
|
||||
import os,json,random,time,re,string,functools,asyncio
|
||||
import sys
|
||||
sys.path.append('../../tmp')
|
||||
print('\n运行本脚本之前请手动进入游戏点击一个方块\n')
|
||||
print('\n挖的如果都是0.01红包就是黑了,别挣扎了!\n')
|
||||
print('\n默认自动领取奖励,关闭请在代码383行加上#号注释即可\n')
|
||||
try:
|
||||
import requests
|
||||
except Exception as e:
|
||||
print(str(e) + "\n缺少requests模块, 请执行命令:pip3 install requests\n")
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
|
||||
linkId="pTTvJeSTrpthgk9ASBVGsw"
|
||||
|
||||
|
||||
# 获取pin
|
||||
cookie_findall=re.compile(r'pt_pin=(.+?);')
|
||||
def get_pin(cookie):
|
||||
try:
|
||||
return cookie_findall.findall(cookie)[0]
|
||||
except:
|
||||
print('ck格式不正确,请检查')
|
||||
|
||||
# 读取环境变量
|
||||
def get_env(env):
|
||||
try:
|
||||
if env in os.environ:
|
||||
a=os.environ[env]
|
||||
elif '/ql' in os.path.abspath(os.path.dirname(__file__)):
|
||||
try:
|
||||
a=v4_env(env,'/ql/config/config.sh')
|
||||
except:
|
||||
a=eval(env)
|
||||
elif '/jd' in os.path.abspath(os.path.dirname(__file__)):
|
||||
try:
|
||||
a=v4_env(env,'/jd/config/config.sh')
|
||||
except:
|
||||
a=eval(env)
|
||||
else:
|
||||
a=eval(env)
|
||||
except:
|
||||
a=''
|
||||
return a
|
||||
|
||||
# v4
|
||||
def v4_env(env,paths):
|
||||
b=re.compile(r'(?:export )?'+env+r' ?= ?[\"\'](.*?)[\"\']', re.I)
|
||||
with open(paths, 'r') as f:
|
||||
for line in f.readlines():
|
||||
try:
|
||||
c=b.match(line).group(1)
|
||||
break
|
||||
except:
|
||||
pass
|
||||
return c
|
||||
|
||||
|
||||
# 随机ua
|
||||
def ua():
|
||||
sys.path.append(os.path.abspath('.'))
|
||||
try:
|
||||
from jdEnv import USER_AGENTS as a
|
||||
except:
|
||||
a='jdpingou;android;5.5.0;11;network/wifi;model/M2102K1C;appBuild/18299;partner/lcjx11;session/110;pap/JA2019_3111789;brand/Xiaomi;Mozilla/5.0 (Linux; Android 11; M2102K1C Build/RKQ1.201112.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.159 Mobile Safari/537.36'
|
||||
return a
|
||||
|
||||
# 13位时间戳
|
||||
def gettimestamp():
|
||||
return str(int(time.time() * 1000))
|
||||
|
||||
## 获取cooie
|
||||
class Judge_env(object):
|
||||
def main_run(self):
|
||||
if '/jd' in os.path.abspath(os.path.dirname(__file__)):
|
||||
cookie_list=self.v4_cookie()
|
||||
else:
|
||||
cookie_list=os.environ["JD_COOKIE"].split('&') # 获取cookie_list的合集
|
||||
if len(cookie_list)<1:
|
||||
print('请填写环境变量JD_COOKIE\n')
|
||||
return cookie_list
|
||||
|
||||
def v4_cookie(self):
|
||||
a=[]
|
||||
b=re.compile(r'Cookie'+'.*?=\"(.*?)\"', re.I)
|
||||
with open('/jd/config/config.sh', 'r') as f:
|
||||
for line in f.readlines():
|
||||
try:
|
||||
regular=b.match(line).group(1)
|
||||
a.append(regular)
|
||||
except:
|
||||
pass
|
||||
return a
|
||||
cookie_list=Judge_env().main_run()
|
||||
|
||||
|
||||
def taskGetUrl(functionId, body, cookie):
|
||||
url=f'https://api.m.jd.com/?functionId={functionId}&body={json.dumps(body)}&t={gettimestamp()}&appid=activities_platform&client=H5&clientVersion=1.0.0'
|
||||
headers={
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'origin': 'https://bnzf.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
"User-Agent": ua(),
|
||||
'Accept-Language': 'zh-cn',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
}
|
||||
for n in range(3):
|
||||
try:
|
||||
res=requests.get(url,headers=headers, timeout=10).json()
|
||||
return res
|
||||
except:
|
||||
if n==2:
|
||||
print('API请求失败,请检查网路重试❗\n')
|
||||
|
||||
|
||||
# 剩余血量
|
||||
def xueliang(cookie):
|
||||
body={"linkId":linkId,"round":1}
|
||||
res=taskGetUrl("happyDigHome", body, cookie)
|
||||
if not res:
|
||||
return
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
curRound=res['data']['curRound'] # 未知
|
||||
blood=res['data']['blood'] # 剩余血量
|
||||
return blood
|
||||
|
||||
def jinge(cookie,i):
|
||||
body={"linkId":linkId}
|
||||
res=taskGetUrl("happyDigHome", body, cookie)
|
||||
if not res:
|
||||
return
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
curRound=res['data']['curRound'] # 未知
|
||||
blood=res['data']['blood'] # 剩余血量
|
||||
roundList=res['data']['roundList'] # 3个总池子
|
||||
roundList_n=roundList[0]
|
||||
redAmount=roundList_n['redAmount'] # 当前池已得京东红包
|
||||
cashAmount=roundList_n['cashAmount'] # 当前池已得微信红包
|
||||
|
||||
return [blood,redAmount,cashAmount]
|
||||
|
||||
# 页面数据
|
||||
def happyDigHome(cookie):
|
||||
body={"linkId":linkId,"round":1}
|
||||
res=taskGetUrl("happyDigHome", body, cookie)
|
||||
exit_flag = "false"
|
||||
if not res:
|
||||
return
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
curRound=res['data']['curRound'] # 未知
|
||||
incep_blood=res['data']['blood'] # 剩余血量
|
||||
roundList=res['data']['roundList'] # 3个总池子
|
||||
for e,roundList_n in enumerate(roundList): # 迭代每个池子
|
||||
roundid=roundList_n['round'] # 池序号
|
||||
state=roundList_n['state']
|
||||
rows=roundList_n['rows'] # 池规模,rows*rows
|
||||
redAmount=roundList_n['redAmount'] # 当前池已得京东红包
|
||||
cashAmount=roundList_n['cashAmount'] # 当前池已得微信红包
|
||||
leftAmount=roundList_n['leftAmount'] # 剩余红包?
|
||||
chunks=roundList_n['chunks'] # 当前池详情list
|
||||
|
||||
a=jinge(cookie,roundid)
|
||||
if roundid==1:
|
||||
print(f'\n开始 "入门" 难度关卡({rows}*{rows})')
|
||||
elif roundid==2:
|
||||
print(f'\n开始 "挑战" 难度关卡({rows}*{rows})')
|
||||
elif roundid==3:
|
||||
print(f'\n开始 "终极" 难度关卡({rows}*{rows})')
|
||||
print(f'当前剩余血量 {a[0]}🩸')
|
||||
## print(f'当前池已得京东红包 {a[2]}\n当前池已得微信红包 {a[1]}\n')
|
||||
_blood=xueliang(cookie)
|
||||
if _blood>1 or incep_blood>=21:
|
||||
happyDigDo(cookie,roundid,0,0)
|
||||
if e==0 or e==1:
|
||||
roundid_n=4
|
||||
else:
|
||||
roundid_n=5
|
||||
for n in range(roundid_n):
|
||||
for i in range(roundid_n):
|
||||
_blood=xueliang(cookie)
|
||||
if _blood>1 or incep_blood>=21:
|
||||
## print(f'当前血量为 {_blood}')
|
||||
a=n+1
|
||||
b=i+1
|
||||
print(f'挖取坐标({a},{b})')
|
||||
happyDigDo(cookie,roundid,n,i)
|
||||
else:
|
||||
a=jinge(cookie,roundid)
|
||||
print(f'没血了,不挖了')
|
||||
exit_flag = "true"
|
||||
## print(f'当前池已得京东红包 {a[2]}\n当前池已得微信红包 {a[1]}\n')
|
||||
break
|
||||
|
||||
if exit_flag == "true":
|
||||
break
|
||||
if exit_flag == "true":
|
||||
break
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
|
||||
|
||||
# 玩一玩
|
||||
def apDoTask(cookie):
|
||||
print('开始做玩一玩任务')
|
||||
body={"linkId":linkId,"taskType":"BROWSE_CHANNEL","taskId":454,"channel":4,"itemId":"https%3A%2F%2Fsignfree.jd.com%2F%3FactivityId%3DPiuLvM8vamONsWzC0wqBGQ","checkVersion":False}
|
||||
res=taskGetUrl('apDoTask', body, cookie)
|
||||
if not res:
|
||||
return
|
||||
try:
|
||||
if res['success']:
|
||||
print('玩好了')
|
||||
else:
|
||||
print(f"{res['errMsg']}")
|
||||
except:
|
||||
print(f"错误\n{res}")
|
||||
|
||||
|
||||
# 挖宝
|
||||
def happyDigDo(cookie,roundid,rowIdx,colIdx):
|
||||
body={"round":roundid,"rowIdx":rowIdx,"colIdx":colIdx,"linkId":linkId}
|
||||
res=taskGetUrl("happyDigDo", body, cookie)
|
||||
if not res:
|
||||
return
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
typeid=res['data']['chunk']['type']
|
||||
if typeid==2:
|
||||
print(f"获得极速版红包 {res['data']['chunk']['value']} 🧧\n")
|
||||
elif typeid==3:
|
||||
print(f"🎉 获得微信零钱 {res['data']['chunk']['value']} 💰\n")
|
||||
elif typeid==4:
|
||||
print(f"💥Boom💥 挖到了炸弹 💣\n")
|
||||
elif typeid==1:
|
||||
print(f"获得优惠券 🎟️\n")
|
||||
else:
|
||||
print(f'不知道挖到了什么 🎁\n')
|
||||
else:
|
||||
print(f'{res}\n挖宝失败\n')
|
||||
else:
|
||||
print(f'{res}\n挖宝失败\n')
|
||||
|
||||
# # 助力码
|
||||
# def inviteCode(cookie):
|
||||
# global inviteCode_1_list,inviteCode_2_list
|
||||
# body={"linkId":linkId}
|
||||
# res=taskGetUrl("happyDigHome", body, cookie)
|
||||
# if not res:
|
||||
# return
|
||||
# try:
|
||||
# if res['success']:
|
||||
# print(f"账号{get_pin(cookie)}助力码为{res['data']['inviteCode']}")
|
||||
# inviteCode_1_list.append(res['data']['inviteCode'])
|
||||
# print(f"账号{get_pin(cookie)}助力码为{res['data']['markedPin']}")
|
||||
# inviteCode_2_list.append(res['data']['markedPin'])
|
||||
# else:
|
||||
# print('快去买买买吧')
|
||||
# except:
|
||||
# print(f"错误\n{res}\n")
|
||||
|
||||
# # 助力
|
||||
# def happyDigHelp(cookie,fcwbinviter,fcwbinviteCode):
|
||||
# print(f"账号 {get_pin(cookie)} 去助力{fcwbinviteCode}")
|
||||
# xueliang(cookie)
|
||||
# body={"linkId":linkId,"inviter":fcwbinviter,"inviteCode":fcwbinviteCode}
|
||||
# res=taskGetUrl("happyDigHelp", body, cookie)
|
||||
# if res['success']:
|
||||
# print('助力成功')
|
||||
# else:
|
||||
# print(res['errMsg'])
|
||||
|
||||
# 领取奖励
|
||||
def happyDigExchange(cookie):
|
||||
for n in range(1,4):
|
||||
xueliang(cookie)
|
||||
print(f"\n开始领取第{n}场的奖励")
|
||||
body={"round":n,"linkId":linkId}
|
||||
res=taskGetUrl("happyDigExchange", body, cookie)
|
||||
if not res:
|
||||
return
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
try:
|
||||
print(f"已领取极速版红包 {res['data']['redValue']} 🧧")
|
||||
except:
|
||||
print('')
|
||||
if res['data']['wxValue'] != "0":
|
||||
try:
|
||||
print(f"可提现微信零钱 {res['data']['wxValue']} 💰")
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
print(res['errMsg'])
|
||||
else:
|
||||
print(res['errMsg'])
|
||||
|
||||
|
||||
|
||||
# 微信现金id
|
||||
def spring_reward_list(cookie):
|
||||
happyDigExchange(cookie)
|
||||
xueliang(cookie)
|
||||
|
||||
body={"linkId":linkId,"pageNum":1,"pageSize":6}
|
||||
res=taskGetUrl("spring_reward_list", body, cookie)
|
||||
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
items=res['data']['items']
|
||||
for _items in items:
|
||||
amount=_items['amount'] # 金额
|
||||
prizeDesc=_items['prizeDesc'] # 金额备注
|
||||
amountid=_items['id'] # 金额id
|
||||
poolBaseId=_items['poolBaseId']
|
||||
prizeGroupId=_items['prizeGroupId']
|
||||
prizeBaseId=_items['prizeBaseId']
|
||||
if '红包' in f"{prizeDesc}":
|
||||
continue
|
||||
if '券' in f"{prizeDesc}":
|
||||
continue
|
||||
else:
|
||||
print('\n去提现微信零钱 💰')
|
||||
time.sleep(3.2)
|
||||
wecat(cookie,amountid,poolBaseId,prizeGroupId,prizeBaseId)
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
|
||||
# 微信提现
|
||||
def wecat(cookie,amountid,poolBaseId,prizeGroupId,prizeBaseId):
|
||||
xueliang(cookie)
|
||||
|
||||
url='https://api.m.jd.com'
|
||||
headers={
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Connection': 'keep-alive',
|
||||
'origin': 'https://bnzf.jd.com',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
"User-Agent": ua(),
|
||||
'Accept-Language': 'zh-cn',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
}
|
||||
body={"businessSource":"happyDiggerH5Cash","base":{"id":amountid,"business":"happyDigger","poolBaseId":poolBaseId,"prizeGroupId":prizeGroupId,"prizeBaseId":prizeBaseId,"prizeType":4},"linkId":linkId}
|
||||
data=f"functionId=apCashWithDraw&body={json.dumps(body)}&t=1635596380119&appid=activities_platform&client=H5&clientVersion=1.0.0"
|
||||
for n in range(3):
|
||||
try:
|
||||
res=requests.post(url,headers=headers,data=data,timeout=10).json()
|
||||
break
|
||||
except:
|
||||
if n==2:
|
||||
print('API请求失败,请检查网路重试❗\n')
|
||||
try:
|
||||
if res['code']==0:
|
||||
if res['success']:
|
||||
print(res['data']['message']+'\n')
|
||||
except:
|
||||
print(res)
|
||||
print('')
|
||||
|
||||
|
||||
def main():
|
||||
print('🔔发财挖宝,开始!\n')
|
||||
|
||||
# print('获取助力码\n')
|
||||
# global inviteCode_1_list,inviteCode_2_list
|
||||
# inviteCode_1_list=list()
|
||||
# inviteCode_2_list=list()
|
||||
# for cookie in cookie_list:
|
||||
# inviteCode(cookie)
|
||||
|
||||
# print('互助\n')
|
||||
# inviteCode_2_list=inviteCode_2_list[:2]
|
||||
# for e,fcwbinviter in enumerate(inviteCode_2_list):
|
||||
# fcwbinviteCode=inviteCode_1_list[e]
|
||||
# for cookie in cookie_list:
|
||||
# happyDigHelp(cookie,fcwbinviter,fcwbinviteCode)
|
||||
|
||||
print(f'====================共{len(cookie_list)}京东个账号Cookie=========\n')
|
||||
|
||||
for e,cookie in enumerate(cookie_list,start=1):
|
||||
print(f'******开始【账号 {e}】 {get_pin(cookie)} *********\n')
|
||||
apDoTask(cookie)
|
||||
happyDigHome(cookie)
|
||||
spring_reward_list(cookie)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
248
jd_fcwb_help.js
248
jd_fcwb_help.js
File diff suppressed because one or more lines are too long
22
jd_fcwb_tmp.js
Normal file
22
jd_fcwb_tmp.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
333
jd_prodev.py
Normal file
333
jd_prodev.py
Normal file
@ -0,0 +1,333 @@
|
||||
# 邀好友赢大礼 create by doubi 通用模板
|
||||
# 17:/椋东送福利,邀请好友,争排行榜排位,大礼送不停,(E1Y7RAtC4b) ,升级新版猄·=·Dσσōngαpρ
|
||||
# https://prodev.m.jd.com/mall/active/dVF7gQUVKyUcuSsVhuya5d2XD4F/index.html?code=7cfd02e34d6d41028286d6a95cdeea7e&invitePin=jd_5a2bee883014b
|
||||
# 注意事项 pin 为助力pin 必须保证ck在里面
|
||||
# by 逗比 https://t.me/jdsign2
|
||||
|
||||
import json
|
||||
import requests,random,time,asyncio,re,os
|
||||
from urllib.parse import quote_plus,unquote_plus
|
||||
from functools import partial
|
||||
print = partial(print, flush=True)
|
||||
|
||||
activatyname = '邀请赢大礼'
|
||||
activityId = 'dVF7gQUVKyUcuSsVhuya5d2XD4F' # 活动类型
|
||||
authorCode = '' # 活动id
|
||||
invitePin = '' # pin 填写cookie后面的pin
|
||||
activityUrl = f'https://prodev.m.jd.com/mall/active/{activityId}/index.html?code={authorCode}&invitePin={invitePin}'
|
||||
|
||||
# 随机ua
|
||||
def randomuserAgent():
|
||||
global uuid, addressid, iosVer, iosV, clientVersion, iPhone, area, ADID, lng, lat
|
||||
uuid = ''.join(random.sample(
|
||||
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'z'], 40))
|
||||
addressid = ''.join(random.sample('1234567898647', 10))
|
||||
iosVer = ''.join(random.sample(["15.1.1", "14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
|
||||
iosV = iosVer.replace('.', '_')
|
||||
clientVersion = ''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
|
||||
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
|
||||
area = ''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(
|
||||
random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
|
||||
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(
|
||||
random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(
|
||||
random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
|
||||
lng = '119.31991256596' + str(random.randint(100, 999))
|
||||
lat = '26.1187118976' + str(random.randint(100, 999))
|
||||
UserAgent = ''
|
||||
if not UserAgent:
|
||||
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
|
||||
else:
|
||||
return UserAgent
|
||||
|
||||
# 检测ck状态
|
||||
async def check(ua, ck):
|
||||
try:
|
||||
url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion'
|
||||
header = {
|
||||
"Host": "me-api.jd.com",
|
||||
"Accept": "*/*",
|
||||
"Connection": "keep-alive",
|
||||
"Cookie": ck,
|
||||
"User-Agent": ua,
|
||||
"Accept-Language": "zh-cn",
|
||||
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
}
|
||||
result = requests.get(url=url, headers=header, timeout=2).text
|
||||
codestate = json.loads(result)
|
||||
if codestate['retcode'] == '1001':
|
||||
msg = "当前ck已失效,请检查"
|
||||
return {'code': 1001, 'data': msg}
|
||||
elif codestate['retcode'] == '0' and 'userInfo' in codestate['data']:
|
||||
nickName = codestate['data']['userInfo']['baseInfo']['nickname']
|
||||
return {'code': 200, 'name': nickName, 'ck': ck}
|
||||
except Exception as e:
|
||||
return {'code': 0, 'data': e}
|
||||
|
||||
# 获取当前时间
|
||||
def get_time():
|
||||
time_now = round(time.time()*1000)
|
||||
return time_now
|
||||
|
||||
# 登录plogin
|
||||
async def plogin(ua,cookie):
|
||||
now = get_time()
|
||||
url = f'https://plogin.m.jd.com/cgi-bin/ml/islogin?time={now}&callback=__jsonp{now-2}&_={now+2}'
|
||||
header = {
|
||||
'Accept':'*/*',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Connection': 'keep-alive',
|
||||
'Cookie': cookie,
|
||||
'Host': 'plogin.m.jd.com',
|
||||
'Referer': 'https://prodev.m.jd.com/',
|
||||
'User-Agent':ua
|
||||
}
|
||||
response = requests.get(url=url,headers=header,timeout=5).text
|
||||
return response
|
||||
|
||||
# 活动接口
|
||||
async def jdjoy(ua,cookie):
|
||||
|
||||
url = f'https://jdjoy.jd.com/member/bring/getActivityPage?code={authorCode}&invitePin={invitePin}&_t={get_time()}'
|
||||
header = {
|
||||
'Accept':'*/*',
|
||||
'Accept-Encoding':'gzip, deflate',
|
||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
||||
'Connection':'keep-alive',
|
||||
'Content-Type':'application/json',
|
||||
'Cookie':cookie,
|
||||
"Host":'jdjoy.jd.com',
|
||||
'Origin':'https://prodev.m.jd.com',
|
||||
"Referer":'https://prodev.m.jd.com/',
|
||||
'User-Agent':ua
|
||||
}
|
||||
response = requests.get(url=url,headers=header).text
|
||||
return json.loads(response)
|
||||
|
||||
# go开卡
|
||||
async def ruhui(ua,cookie):
|
||||
url = f'https://jdjoy.jd.com/member/bring/joinMember?code={authorCode}&invitePin={invitePin}'
|
||||
header = {
|
||||
'Host': 'jdjoy.jd.com',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://prodev.m.jd.com',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Cookie': cookie,
|
||||
'Connection': 'keep-alive',
|
||||
'Accept': '*/*',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Accept-Language': 'zh-cn',
|
||||
'request-from': 'native'
|
||||
}
|
||||
response = requests.get(url=url,headers=header).text
|
||||
return json.loads(response)
|
||||
|
||||
# 检查开卡状态
|
||||
async def check_ruhui(body,cookie,venderId,ua):
|
||||
url = f'https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=getShopOpenCardInfo&body={json.dumps(body)}&client=H5&clientVersion=9.2.0&uuid=88888'
|
||||
headers = {
|
||||
'Host': 'api.m.jd.com',
|
||||
'Accept': '*/*',
|
||||
'Connection': 'keep-alive',
|
||||
'Cookie': cookie,
|
||||
'User-Agent': ua,
|
||||
'Accept-Language': 'zh-cn',
|
||||
'Referer': f'https://shopmember.m.jd.com/shopcard/?venderId={venderId}&channel=801&returnUrl={json.dumps(activityUrl)}',
|
||||
'Accept-Encoding': 'gzip, deflate'
|
||||
}
|
||||
response = requests.get(url=url,headers=headers,timeout=5).text
|
||||
return json.loads(response)
|
||||
|
||||
# 领取奖励
|
||||
async def getInviteReward(cookie,ua,number):
|
||||
url = f'https://jdjoy.jd.com/member/bring/getInviteReward?code={authorCode}&stage={number}'
|
||||
header = {
|
||||
'Accept':'*/*',
|
||||
'Accept-Encoding':'gzip, deflate',
|
||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
||||
'Connection':'keep-alive',
|
||||
'Content-Type':'application/json',
|
||||
'Cookie':cookie,
|
||||
"Host":'jdjoy.jd.com',
|
||||
'Origin':'https://prodev.m.jd.com',
|
||||
"Referer":'https://prodev.m.jd.com/',
|
||||
'User-Agent':ua
|
||||
}
|
||||
response = requests.get(url=url,headers=header).text
|
||||
return json.loads(response)
|
||||
|
||||
# 开启活动
|
||||
async def firstInvite(cookie,ua):
|
||||
url = f'https://jdjoy.jd.com/member/bring/firstInvite?code={authorCode}'
|
||||
header = {
|
||||
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'Accept-Encoding':'gzip, deflate',
|
||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
||||
'Connection':'keep-alive',
|
||||
'Cookie':cookie,
|
||||
"Host":'jdjoy.jd.com',
|
||||
'User-Agent':ua
|
||||
}
|
||||
response = requests.get(url=url,headers=header).text
|
||||
print(response)
|
||||
return json.loads(response)
|
||||
|
||||
async def get_ck(data):
|
||||
cklist = []
|
||||
if data['code']!=200:
|
||||
return {'code': 0, 'data':data}
|
||||
else:
|
||||
env_data = data['data']
|
||||
for ck in env_data:
|
||||
if 'remarks' in ck and ck['name']=='JD_COOKIE':
|
||||
cklist.append(ck['value'])
|
||||
else:
|
||||
pass
|
||||
return cklist
|
||||
|
||||
|
||||
# 检查pin
|
||||
def checkpin(cks:list,pin):
|
||||
for ck in cks:
|
||||
if pin in ck:
|
||||
return ck
|
||||
else:
|
||||
None
|
||||
|
||||
# 主程序
|
||||
async def main():
|
||||
try:
|
||||
cks = os.environ["JD_COOKIE"].split("&")
|
||||
except:
|
||||
with open('cklist1.txt','r') as f:
|
||||
cks = f.read().split('\n')
|
||||
success = 0 # 计算成功数
|
||||
inveteck = checkpin(cks,invitePin) # 根据设定的pin返回对应ck
|
||||
needinviteNum = [] # 需要助力次数
|
||||
needdel = []
|
||||
need = []
|
||||
if inveteck:
|
||||
print(f'🔔{activatyname}', flush=True)
|
||||
print(f'==================共{len(cks)}个京东账号Cookie==================')
|
||||
print(f'==================脚本执行- 北京时间(UTC+8):{get_time()}=====================\n')
|
||||
print(f'您好!{invitePin},正在获取您的活动信息',)
|
||||
ua = randomuserAgent() # 获取ua
|
||||
result = await check(ua, inveteck) # 检测ck
|
||||
if result['code'] == 200:
|
||||
await plogin(ua,inveteck) # 获取登录状态
|
||||
await asyncio.sleep(2)
|
||||
result = await jdjoy(ua,inveteck) # 获取活动信息
|
||||
await firstInvite(inveteck,ua) # 开启活动
|
||||
if result['success']:
|
||||
brandName = result['data']['brandName'] # 店铺名字
|
||||
venderId = result['data']['venderId'] # 店铺入会id
|
||||
rewardslist =[] # 奖品
|
||||
successCount = result['data']['successCount'] # 当前成功数
|
||||
success += successCount
|
||||
result_data = result['data']['rewards'] # 奖品数据
|
||||
print(f'您好!账号[{invitePin}],开启{brandName}邀请好友活动\n去开活动')
|
||||
for i in result_data:
|
||||
stage = i['stage']
|
||||
inviteNum = i['inviteNum'] # 单次需要拉新人数
|
||||
need.append(inviteNum)
|
||||
rewardName = i['rewardName'] # 奖品名
|
||||
rewardNum = i['rewardStock']
|
||||
if rewardNum !=0:
|
||||
needinviteNum.append(inviteNum)
|
||||
needdel.append(inviteNum)
|
||||
rewardslist.append(f'级别{stage}: 需助力{inviteNum}人,奖品: {rewardName},库存:{rewardNum}件\n')
|
||||
if len(rewardslist)!=0:
|
||||
print('当前活动奖品如下: \n'+str('\n'.join(rewardslist))+f'\n当前已助力{successCount}次\n')
|
||||
for nmubers in needdel:
|
||||
if success >= nmubers:
|
||||
print("您当前助力已经满足了,可以去领奖励了")
|
||||
print(f'\n这就去领取奖励{need.index(nmubers)+1}')
|
||||
result = await getInviteReward(inveteck,ua,need.index(nmubers)+1)
|
||||
print(result)
|
||||
needinviteNum.remove(nmubers)
|
||||
await asyncio.sleep(10)
|
||||
needdel = needinviteNum
|
||||
if needinviteNum == []:
|
||||
print('奖励已经全部获取啦,退出程序')
|
||||
return
|
||||
for n,ck in enumerate(cks,1):
|
||||
ua = randomuserAgent() # 获取ua
|
||||
try:
|
||||
pin = re.findall(r'(pt_pin=([^; ]+)(?=;))',str(ck))[0]
|
||||
pin = (unquote_plus(pin[1]))
|
||||
except IndexError:
|
||||
pin = f'用户{n}'
|
||||
print(f'******开始【京东账号{n}】{pin} *********\n')
|
||||
for n,nmubers in enumerate(needinviteNum,1):
|
||||
for nmubers in needdel:
|
||||
if success >= nmubers:
|
||||
print(nmubers)
|
||||
print("您当前助力已经满足了,可以去领奖励了")
|
||||
print(f'\n这就去领取奖励{need.index(nmubers)+1}')
|
||||
result = await getInviteReward(inveteck,ua,need.index(nmubers)+1)
|
||||
print(result)
|
||||
needinviteNum.remove(nmubers)
|
||||
await asyncio.sleep(10)
|
||||
needdel = needinviteNum
|
||||
if needinviteNum == []:
|
||||
print('奖励已经全部获取啦,退出程序')
|
||||
return
|
||||
await plogin(ua,ck) # 获取登录状态
|
||||
result = await check(ua, ck) # 检测ck
|
||||
if result['code'] == 200:
|
||||
result = await jdjoy(ua,ck) # 调用ck
|
||||
if result['success']:
|
||||
print(f'账户[{pin}]已开启{brandName}邀请好友活动\n')
|
||||
await asyncio.sleep(3)
|
||||
result= await check_ruhui({"venderId":str(venderId), "channel": "401" },ck,venderId,ua) # 检查入会状态
|
||||
try:
|
||||
if result['result']['userInfo']['openCardStatus']==0: # 0 未开卡
|
||||
await asyncio.sleep(2)
|
||||
print(f'您还不是会员哦,这就去去助力{invitePin}\n')
|
||||
result = await ruhui(ua,ck)
|
||||
if result['success']:
|
||||
success +=1
|
||||
print(f'助力成功! 当前成功助力{success}个\n')
|
||||
if '交易失败' in str(result):
|
||||
success +=1
|
||||
print(f'助力成功! 当前成功助力{success}个\n')
|
||||
else:
|
||||
print(result)
|
||||
await asyncio.sleep(2)
|
||||
else:
|
||||
print('您已经是会员啦,不去请求了入会了\n')
|
||||
continue
|
||||
|
||||
except TypeError as e:
|
||||
print(e)
|
||||
result = await ruhui(ua,ck)
|
||||
if result['success']:
|
||||
success +=1
|
||||
print(f'助力成功! 当前成功助力{success}个\n')
|
||||
if '交易失败' in result:
|
||||
success +=1
|
||||
print(f'助力成功! 当前成功助力{success}个\n')
|
||||
else:
|
||||
print(result['errorMessage'])
|
||||
await asyncio.sleep(2)
|
||||
|
||||
else: # 没有获取到活动信息
|
||||
print('未获取到活动参数信息\n')
|
||||
break
|
||||
else:
|
||||
print(result['data'])
|
||||
continue
|
||||
else:
|
||||
print('未能获取到活动信息\n')
|
||||
return
|
||||
|
||||
else:
|
||||
print(result['data'])
|
||||
return
|
||||
else:
|
||||
print(f'pin填写有误,请重试')
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user