mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
expired
This commit is contained in:
parent
c9d9a76dee
commit
53d2b2eaa3
File diff suppressed because one or more lines are too long
14
jd_fanshb.js
14
jd_fanshb.js
File diff suppressed because one or more lines are too long
389
jd_fcwb.py
389
jd_fcwb.py
@ -1,389 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
cron: 11 11 10 11 * jd_fcwb.py
|
||||
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默认关闭自动领取奖励,开启请在主函数最后调用的函数前面删除#号注释即可\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 = 'jdltapp;iPhone;3.8.18;;;M/5.0;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;hasOCPay/0;appBuild/1157;supportBestPay/0;jdSupportDarkMode/0;ef/1;ep/%7B%22ciphertype%22%3A5%2C%22cipher%22%3A%7B%22ud%22%3A%22D2PtYzKmY2S5ENY0ZJqmDNTrDtrtZtrsCWPuDtSzY2DvYzq3Y2GzDm%3D%3D%22%2C%22sv%22%3A%22CJCkDm%3D%3D%22%2C%22iad%22%3A%22%22%7D%2C%22ts%22%3A1660017794%2C%22hdid%22%3A%22TQXsGHnakmmgYnwstgBuo1lumKk2DznsrnZM56ldiQM%22%2C%22version%22%3A%221.0.3%22%2C%22appname%22%3A%22com.jd.jdmobilelite%22%2C%22ridx%22%3A1%7D;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;'
|
||||
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()
|
||||
async 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(5):
|
||||
time.sleep(1)
|
||||
try:
|
||||
res = requests.get(url, headers=headers, timeout=30).json()
|
||||
return res
|
||||
except Exception as e:
|
||||
# errorMsg = f"❌ 第{e.__traceback__.tb_lineno}行:{e}"
|
||||
# print(errorMsg)
|
||||
if n == 4:
|
||||
print('API请求失败,请检查网路重试❗\n')
|
||||
|
||||
|
||||
# 剩余血量
|
||||
async def xueliang(cookie):
|
||||
body = {"linkId": linkId}
|
||||
res = await 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
|
||||
|
||||
|
||||
async def jinge(cookie, i):
|
||||
body = {"linkId": linkId}
|
||||
res = await 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]
|
||||
|
||||
# 页面数据
|
||||
async def happyDigHome(cookie):
|
||||
body = {"linkId": linkId}
|
||||
res = await 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*rows
|
||||
rows = roundList_n['rows']
|
||||
# 当前池已得京东红包
|
||||
redAmount = roundList_n['redAmount']
|
||||
# 当前池已得微信红包
|
||||
cashAmount = roundList_n['cashAmount']
|
||||
leftAmount = roundList_n['leftAmount'] # 剩余红包?
|
||||
# 当前池详情list
|
||||
chunks = roundList_n['chunks']
|
||||
a = await jinge(cookie, roundid)
|
||||
if roundid == 1:
|
||||
print(f'\n开始进行 "入门" 难度关卡,剩余血量 {a[0]}🩸\n')
|
||||
elif roundid == 2:
|
||||
print(f'\n开始进行 "挑战" 难度关卡,剩余血量 {a[0]}🩸\n')
|
||||
elif roundid == 3:
|
||||
print(f'\n开始进行 "终极" 难度关卡,剩余血量 {a[0]}🩸\n')
|
||||
## print(f'当前池已得京东红包 {a[2]}\n当前池已得微信红包 {a[1]}\n')
|
||||
_blood = await xueliang(cookie)
|
||||
if _blood > 1:
|
||||
# await 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 = await xueliang(cookie)
|
||||
if _blood > 1:
|
||||
## print(f'当前血量为 {_blood}')
|
||||
await happyDigDo(cookie, roundid, n, i)
|
||||
else:
|
||||
a = await jinge(cookie, roundid)
|
||||
print(f'没血了,溜了溜了\n')
|
||||
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')
|
||||
|
||||
|
||||
# 玩一玩
|
||||
async def apDoTask(cookie):
|
||||
print('开始做玩一玩任务')
|
||||
body={"linkId":linkId,"taskType":"BROWSE_CHANNEL","taskId":962,"channel":4,"itemId":"https%3A%2F%2Fwqs.jd.com%2Fsns%2F202210%2F20%2Fmake-money-shop%2Findex.html%3FactiveId%3D63526d8f5fe613a6adb48f03","checkVersion":False}
|
||||
res = await taskGetUrl('apDoTask', body, cookie)
|
||||
if not res:
|
||||
return
|
||||
try:
|
||||
if res['success']:
|
||||
print('玩好了')
|
||||
else:
|
||||
print(f"{res['errMsg']}")
|
||||
except:
|
||||
print(f"错误\n{res}")
|
||||
|
||||
|
||||
# 挖宝
|
||||
async def happyDigDo(cookie, roundid, rowIdx, colIdx):
|
||||
body = {"round": roundid, "rowIdx": rowIdx,
|
||||
"colIdx": colIdx, "linkId": linkId}
|
||||
res = await taskGetUrl("happyDigDo", body, cookie)
|
||||
|
||||
a = rowIdx + 1
|
||||
b = colIdx + 1
|
||||
coordinateText = f"坐标({a},{b}) ➜ "
|
||||
if not res:
|
||||
return
|
||||
if res['code'] == 0:
|
||||
if res['success']:
|
||||
typeid = res['data']['chunk']['type']
|
||||
if typeid == 2:
|
||||
print(coordinateText + f"🧧 {res['data']['chunk']['value']}元极速版红包")
|
||||
elif typeid == 3:
|
||||
print(coordinateText + f"💰 {res['data']['chunk']['value']}元微信现金")
|
||||
elif typeid == 4:
|
||||
print(coordinateText + f"💣 炸弹")
|
||||
elif typeid == 1:
|
||||
print(coordinateText + f"🎟️ 优惠券")
|
||||
else:
|
||||
print(f'未知内容')
|
||||
else:
|
||||
print(coordinateText + f'挖宝失败({res["errCode"]})')
|
||||
else:
|
||||
print(coordinateText + f'挖宝失败({res["errMsg"]})')
|
||||
|
||||
|
||||
# 领取奖励
|
||||
async def happyDigExchange(cookie):
|
||||
for n in range(1, 4):
|
||||
await xueliang(cookie)
|
||||
# print(f"\n开始领取第{n}场的奖励")
|
||||
body = {"round": n, "linkId": linkId}
|
||||
res = await 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'])
|
||||
|
||||
|
||||
# 微信现金id
|
||||
async def spring_reward_list(cookie):
|
||||
await happyDigExchange(cookie)
|
||||
await xueliang(cookie)
|
||||
|
||||
body = {"linkId": linkId, "pageNum": 1, "pageSize": 6}
|
||||
res = await 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'] # 奖品描述
|
||||
prizeType = _items['prizeType'] # 奖品类型(1券,2红包,4微信零钱)
|
||||
amountid = _items['id'] # 金额id
|
||||
poolBaseId = _items['poolBaseId']
|
||||
prizeGroupId = _items['prizeGroupId']
|
||||
prizeBaseId = _items['prizeBaseId']
|
||||
if prizeType == 4:
|
||||
print(f'开始提现 {amount} 微信现金💰')
|
||||
for n in range(1, 3):
|
||||
result = await WeChat(cookie, amountid, poolBaseId, prizeGroupId, prizeBaseId)
|
||||
time.sleep(10) ## 上一比金额提现完才可以提现下一笔
|
||||
if (result): break
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
else:
|
||||
print(f'获取数据失败\n{res}\n')
|
||||
|
||||
# 微信提现
|
||||
|
||||
|
||||
async def WeChat(cookie, amountid, poolBaseId, prizeGroupId, prizeBaseId):
|
||||
await 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={gettimestamp()}&appid=activities_platform&client=H5&clientVersion=1.0.0"
|
||||
for n in range(3):
|
||||
try:
|
||||
res = requests.post(url, headers=headers, data=data, timeout=30).json()
|
||||
break
|
||||
except:
|
||||
if n == 2:
|
||||
print('API请求失败,请检查网路重试❗\n')
|
||||
try:
|
||||
if res['code'] == 0:
|
||||
if res['success']:
|
||||
print(res['data']['message']+'')
|
||||
return True
|
||||
except:
|
||||
print(res)
|
||||
return False
|
||||
|
||||
|
||||
async 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')
|
||||
await apDoTask(cookie)
|
||||
await happyDigHome(cookie)
|
||||
#await spring_reward_list(cookie)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
177
jd_jdkd1.js
177
jd_jdkd1.js
@ -1,177 +0,0 @@
|
||||
/*
|
||||
京东快递
|
||||
@Leaf
|
||||
|
||||
13 22 * * * jd_jdkd1.js
|
||||
*/
|
||||
const $ = new Env('京东快递');
|
||||
const got = require('got');
|
||||
|
||||
const envSplitor = ['&','\n','@']
|
||||
const ckNames = ['JD_COOKIE']
|
||||
|
||||
const MAX_THREAD = parseInt(process.env['jd_jdkd_thread']) || 5
|
||||
const DEFAULT_TIMEOUT=8000, DEFAULT_RETRY=3;
|
||||
|
||||
const default_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001f2f) NetType/WIFI Language/zh_CN miniProgram/wx73247c7819d61796'
|
||||
const Referer = 'https://jingcai-h5.jd.com/'
|
||||
const Origin = 'https://jingcai-h5.jd.com'
|
||||
|
||||
const client = got.extend({
|
||||
headers:{
|
||||
Connection:'keep-alive',
|
||||
'User-Agent': default_UA,
|
||||
Referer,
|
||||
Origin,
|
||||
AppParams: JSON.stringify({"appid":158,"ticket_type":"m"}),
|
||||
ClientInfo: JSON.stringify({"appName":"jingcai","client":"m"}),
|
||||
'LOP-DN': 'jingcai.jd.com',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
retry: {limit:0},
|
||||
timeout: DEFAULT_TIMEOUT,
|
||||
followRedirect: false,
|
||||
})
|
||||
|
||||
class BasicClass{constructor(){this.index=$.userIdx++;this.name='';} log(msg,opt={}){var m='',n=$.userCount.toString().length;;if(this.index)m+=`账号[${$.padStr(this.index,n)}]`;if(this.name)m+=`[${this.name}]`;$.log(m+msg,opt);} async request(opt){var resp=null,count=0;var fn=opt.fn||opt.url;opt.method=opt?.method?.toUpperCase()||'GET';while(count++<DEFAULT_RETRY){try{await client(opt).then(t=>{resp=t},e=>{resp=e.response});if(((resp?.statusCode/100)|0)<=4)break;}catch(e){if(e.name=='TimeoutError'){this.log(`[${fn}]请求超时,重试第${count}次`);}else{this.log(`[${fn}]请求错误(${e.message}),重试第${count}次`);}};} if(resp==null)return Promise.resolve({statusCode:-1,headers:null,result:null});let{statusCode,headers,body}=resp;if(body)try{body=JSON.parse(body);}catch{};return Promise.resolve({statusCode,headers,result:body})}}
|
||||
let http = new BasicClass();
|
||||
|
||||
class UserClass extends BasicClass {
|
||||
constructor(ck) {
|
||||
super()
|
||||
this.cookie = ck
|
||||
this.pt_pin = ck.match(/pin=([\w\-\%]+)/) ? ck.match(/pin=([\w\-\%]+)/)[1] : ''
|
||||
this.name = decodeURIComponent(this.pt_pin)
|
||||
}
|
||||
|
||||
async queryTaskList() {
|
||||
try {
|
||||
let options = {
|
||||
fn: 'queryTaskList',
|
||||
method: 'post',
|
||||
url: 'https://lop-proxy.jd.com/ESGApi/queryTaskList',
|
||||
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
|
||||
json: [{"pin":"$cooMrdGatewayUid$"}],
|
||||
}
|
||||
let {result} = await this.request(options)
|
||||
let code = result?.code
|
||||
if(code == 1) {
|
||||
for(let task of (result?.content?.taskInfoList||[]).filter(x => x.taskReachNum < x.taskNeedReachNum && x.triggerType==1)) {
|
||||
await this.reachTaskInfo(task);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
let errCode = code || result?.error_response?.code
|
||||
let errMsg = result?.msg || result?.error_response?.zh_desc
|
||||
this.log(`查询任务列表出错[${errCode}]: ${errMsg}`)
|
||||
}
|
||||
} catch (e) {
|
||||
$.log(e)
|
||||
} finally {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
async reachTaskInfo(task) {
|
||||
try {
|
||||
let options = {
|
||||
fn: 'reachTaskInfo',
|
||||
method: 'post',
|
||||
url: 'https://lop-proxy.jd.com/ESGApi/reachTaskInfo',
|
||||
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
|
||||
json: [{
|
||||
taskNo: task.taskNo,
|
||||
childTaskId: task.childTaskId,
|
||||
pin: "$cooMrdGatewayUid$",
|
||||
}],
|
||||
}
|
||||
let {result} = await this.request(options)
|
||||
let code = result?.code
|
||||
if(code == 1) {
|
||||
this.log(`完成任务[${task.taskTitle}]成功`)
|
||||
await this.queryTaskList();
|
||||
} else {
|
||||
let errCode = code || result?.error_response?.code
|
||||
let errMsg = result?.msg || result?.error_response?.zh_desc
|
||||
this.log(`完成任务[${task.taskTitle}]失败[${errCode}]: ${errMsg}`)
|
||||
}
|
||||
} catch (e) {
|
||||
$.log(e)
|
||||
} finally {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
async queryCanGetRewardTaskList() {
|
||||
try {
|
||||
let options = {
|
||||
fn: 'queryCanGetRewardTaskList',
|
||||
method: 'post',
|
||||
url: 'https://lop-proxy.jd.com/ESGApi/queryCanGetRewardTaskList',
|
||||
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
|
||||
json: [{"pin":"$cooMrdGatewayUid$"}],
|
||||
}
|
||||
let {result} = await this.request(options)
|
||||
let code = result?.code
|
||||
if(code == 1) {
|
||||
for(let item of (result?.content?.personalCarbonRewardRespDtoList||[])) {
|
||||
await this.operationPersonalCarbonIntegral(item)
|
||||
}
|
||||
} else {
|
||||
let errCode = code || result?.error_response?.code
|
||||
let errMsg = result?.msg || result?.error_response?.zh_desc
|
||||
this.log(`查询可领取奖励出错[${errCode}]: ${errMsg}`)
|
||||
}
|
||||
} catch (e) {
|
||||
$.log(e)
|
||||
} finally {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
async operationPersonalCarbonIntegral(item) {
|
||||
try {
|
||||
let options = {
|
||||
fn: 'operationPersonalCarbonIntegral',
|
||||
method: 'post',
|
||||
url: 'https://lop-proxy.jd.com/ESGApi/operationPersonalCarbonIntegral',
|
||||
headers: {Cookie:this.cookie,'event-id':$.randomPattern('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx')},
|
||||
json: [{
|
||||
type: 2,
|
||||
operationType: 1,
|
||||
rewardNo: item.rewardNo,
|
||||
taskNo: item.taskNo,
|
||||
pin: "$cooMrdGatewayUid$",
|
||||
}],
|
||||
}
|
||||
let {result} = await this.request(options)
|
||||
let code = result?.code
|
||||
if(code == 1) {
|
||||
this.log(`收取[${item.taskTitle}]奖励成功, 现在有${result?.content?.carbonIntegral}g能量`)
|
||||
} else {
|
||||
let errCode = code || result?.error_response?.code
|
||||
let errMsg = result?.msg || result?.error_response?.zh_desc
|
||||
this.log(`收取[${item.taskTitle}]奖励失败[${errCode}]: ${errMsg}`)
|
||||
}
|
||||
} catch (e) {
|
||||
$.log(e)
|
||||
} finally {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
async userTask() {
|
||||
await this.queryTaskList();
|
||||
await this.queryCanGetRewardTaskList();
|
||||
}
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
$.read_env(UserClass);
|
||||
|
||||
await $.threadTask('userTask',MAX_THREAD)
|
||||
})()
|
||||
.catch((e) => $.log(e))
|
||||
.finally(() => $.exitNow())
|
||||
|
||||
function Env(name){return new class{constructor(name){this.name=name;this.startTime=Date.now();this.log(`[${this.name}]开始运行\n`,{time:true});this.notifyStr=[];this.notifyFlag=true;this.userIdx=0;this.userList=[];this.userCount=0;} log(msg,options={}){let opt={console:true};Object.assign(opt,options);if(opt.time){let fmt=opt.fmt||'hh:mm:ss';msg=`[${this.time(fmt)}]`+msg;} if(opt.notify)this.notifyStr.push(msg);if(opt.console)console.log(msg);} read_env(Class){let envStrList=ckNames.map(x=>process.env[x]);for(let env_str of envStrList.filter(x=>!!x)){let sp=envSplitor.filter(x=>env_str.includes(x));let splitor=sp.length>0?sp[0]:envSplitor[0];for(let ck of env_str.split(splitor).filter(x=>!!x)){this.userList.push(new Class(ck));}} this.userCount=this.userList.length;if(!this.userCount){this.log(`未找到变量,请检查变量${ckNames.map(x => '['+x+']').join('或')}`,{notify:true});return false;} this.log(`共找到${this.userCount}个账号`);return true;} async threads(taskName,conf,opt={}){while(conf.idx<$.userList.length){let user=$.userList[conf.idx++];await user[taskName](opt);}} async threadTask(taskName,thread){let taskAll=[];let taskConf={idx:0};while(thread--)taskAll.push(this.threads(taskName,taskConf));await Promise.all(taskAll);} time(t,x=null){let xt=x?new Date(x):new Date;let e={"M+":xt.getMonth()+1,"d+":xt.getDate(),"h+":xt.getHours(),"m+":xt.getMinutes(),"s+":xt.getSeconds(),"q+":Math.floor((xt.getMonth()+3)/3),S:this.padStr(xt.getMilliseconds(),3)};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(xt.getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t;} async showmsg(){if(!this.notifyFlag)return;if(!this.notifyStr.length)return;var notify=require('./sendNotify');this.log('\n============== 推送 ==============');await notify.sendNotify(this.name,this.notifyStr.join('\n'));} padStr(num,length,opt={}){let padding=opt.padding||'0';let mode=opt.mode||'l';let numStr=String(num);let numPad=(length>numStr.length)?(length-numStr.length):0;let pads='';for(let i=0;i<numPad;i++){pads+=padding;} if(mode=='r'){numStr=numStr+pads;}else{numStr=pads+numStr;} return numStr;} json2str(obj,c,encode=false){let ret=[];for(let keys of Object.keys(obj).sort()){let v=obj[keys];if(v&&encode)v=encodeURIComponent(v);ret.push(keys+'='+v);} return ret.join(c);} str2json(str,decode=false){let ret={};for(let item of str.split('&')){if(!item)continue;let idx=item.indexOf('=');if(idx==-1)continue;let k=item.substr(0,idx);let v=item.substr(idx+1);if(decode)v=decodeURIComponent(v);ret[k]=v;} return ret;} randomPattern(pattern,charset='abcdef0123456789'){let str='';for(let chars of pattern){if(chars=='x'){str+=charset.charAt(Math.floor(Math.random()*charset.length));}else if(chars=='X'){str+=charset.charAt(Math.floor(Math.random()*charset.length)).toUpperCase();}else{str+=chars;}} return str;} randomString(len,charset='abcdef0123456789'){let str='';for(let i=0;i<len;i++){str+=charset.charAt(Math.floor(Math.random()*charset.length));} return str;} randomList(a){let idx=Math.floor(Math.random()*a.length);return a[idx];} wait(t){return new Promise(e=>setTimeout(e,t));} async exitNow(){await this.showmsg();let e=Date.now();let s=(e-this.startTime)/1000;this.log('');this.log(`[${this.name}]运行结束,共运行了${s}秒`,{time:true});process.exit(0);}} (name)}
|
15
jd_jgyx.js
15
jd_jgyx.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,636 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
File: jd_opencardH0320.py(3.20-3.30 春季乐购 共享美好)
|
||||
Author: HarbourJ
|
||||
Date: 2023/3/4 00:00
|
||||
TG: https://t.me/HarbourToulu
|
||||
cron: 7 7 7 7 7
|
||||
new Env('3.20-3.30 春季乐购 共享美好(金币)');
|
||||
ActivityEntry: https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/activity?activityId=ca5653a449b04804a633afff1ebbb546
|
||||
"""
|
||||
|
||||
import time, requests, sys, re, os, json, random
|
||||
from datetime import datetime
|
||||
from urllib.parse import quote_plus, unquote_plus
|
||||
from functools import partial
|
||||
print = partial(print, flush=True)
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
try:
|
||||
from jd_sign import *
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
if "No module" in str(e):
|
||||
print("请先运行HarbourJ库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
||||
sys.exit()
|
||||
try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||
redis_port = os.environ.get("redis_port") if os.environ.get("redis_port") else "6379"
|
||||
redis_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||
inviterUuid = os.environ.get("jd_joinCommon_uuid") if os.environ.get("jd_joinCommon_uuid") else ""
|
||||
|
||||
activityId = "ca5653a449b04804a633afff1ebbb546"
|
||||
shopId = "1000004065"
|
||||
activity_url = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/5929859?activityId={activityId}&shareUuid={inviterUuid}&adsource=null&shareuserid4minipg=null&lng=00.000000&lat=00.000000&sid=&un_area=&&shopid={shopId}"
|
||||
print(f"【🛳活动入口】https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/5929859?activityId={activityId}\n\n🤖本活动为金币邀请,仅开卡与加购,不邀请‼️\n\n🤖本活动为金币邀请,仅开卡与加购,不邀请‼️\n\n🤖本活动为金币邀请,仅开卡与加购,不邀请‼️\n\n")
|
||||
|
||||
def redis_conn():
|
||||
try:
|
||||
import redis
|
||||
try:
|
||||
pool = redis.ConnectionPool(host=redis_url, port=redis_port, decode_responses=True, socket_connect_timeout=5, password=redis_pwd)
|
||||
r = redis.Redis(connection_pool=pool)
|
||||
r.get('conn_test')
|
||||
print('✅redis连接成功')
|
||||
return r
|
||||
except:
|
||||
print("⚠️redis连接异常")
|
||||
except:
|
||||
print("⚠️缺少redis依赖,请运行pip3 install redis")
|
||||
sys.exit()
|
||||
|
||||
def getToken(ck, r=None):
|
||||
host = f'{activityUrl.split("com/")[0]}com'
|
||||
try:
|
||||
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
||||
except:
|
||||
pt_pin = ck[:15]
|
||||
try:
|
||||
try:
|
||||
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
||||
except Exception as e:
|
||||
# print(f"redis get error: {str(e)}")
|
||||
Token = None
|
||||
if Token is not None:
|
||||
print(f"♻️获取缓存Token")
|
||||
return Token
|
||||
else:
|
||||
s.headers = {
|
||||
'Connection': 'keep-alive',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'User-Agent': '',
|
||||
'Cookie': ck,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Referer': '',
|
||||
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
||||
'Accept': '*/*'
|
||||
}
|
||||
sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
||||
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
||||
if f.status_code != 200:
|
||||
print(f.status_code)
|
||||
return
|
||||
else:
|
||||
if "参数异常" in f.text:
|
||||
print(f.text)
|
||||
return
|
||||
Token_new = f.json()['token']
|
||||
try:
|
||||
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
||||
print("✅Token缓存成功")
|
||||
else:
|
||||
print("❌Token缓存失败")
|
||||
except Exception as e:
|
||||
# print(f"redis set error: {str(e)}")
|
||||
print(f"✅获取实时Token")
|
||||
return Token_new
|
||||
except Exception as e:
|
||||
print(f"Token error: {str(e)}")
|
||||
return
|
||||
|
||||
def getJdTime():
|
||||
jdTime = int(round(time.time() * 1000))
|
||||
return jdTime
|
||||
|
||||
def randomString(e, flag=False):
|
||||
t = "0123456789abcdef"
|
||||
if flag: t = t.upper()
|
||||
n = [random.choice(t) for _ in range(e)]
|
||||
return ''.join(n)
|
||||
|
||||
def refresh_cookies(res):
|
||||
if res.cookies:
|
||||
cookies = res.cookies.get_dict()
|
||||
set_cookie = [(set_cookie + "=" + cookies[set_cookie]) for set_cookie in cookies]
|
||||
global activityCookie
|
||||
activityCookieMid = [i for i in activityCookie.split(';') if i != '']
|
||||
for i in activityCookieMid:
|
||||
for x in set_cookie:
|
||||
if i.split('=')[0] == x.split('=')[0]:
|
||||
if i.split('=')[1] != x.split('=')[1]:
|
||||
activityCookieMid.remove(i)
|
||||
activityCookie = ''.join(sorted([(set_cookie + ";") for set_cookie in list(set(activityCookieMid + set_cookie))]))
|
||||
|
||||
def getActivity():
|
||||
url = activityUrl
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'User-Agent': ua,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
if response.status_code == 200:
|
||||
if response.cookies:
|
||||
cookies = response.cookies.get_dict()
|
||||
set_cookies = [(set_cookie + "=" + cookies[set_cookie]) for set_cookie in cookies]
|
||||
set_cookie = ''.join(sorted([(set_cookie + ";") for set_cookie in set_cookies]))
|
||||
return set_cookie
|
||||
else:
|
||||
print(response.status_code, "⚠️ip疑似黑了,休息一会再来撸~")
|
||||
sys.exit()
|
||||
|
||||
def getSystemConfigForNew():
|
||||
url = "https://lzdz1-isv.isvjcloud.com/wxCommonInfo/getSystemConfigForNew"
|
||||
payload = f'activityId={activityId}&activityType=99'
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def getSimpleActInfoVo():
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dz/common/getSimpleActInfoVo"
|
||||
payload = f"activityId={activityId}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def getMyPing(index, venderId):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/customer/getMyPing"
|
||||
payload = f"userId={venderId}&token={token}&fromType=APP"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']['nickname'], res['data']['secretPin']
|
||||
else:
|
||||
print(f"⚠️{res['errorMessage']}")
|
||||
if index == 1 and "火爆" in res['errorMessage']:
|
||||
print(f"\t⛈车头黑,暂时不退出本程序!帮船长跑一下吧😆")
|
||||
# sys.exit()
|
||||
|
||||
def accessLogWithAD(venderId, pin):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/common/accessLogWithAD"
|
||||
payload = f"venderId={venderId}&code=99&pin={quote_plus(pin)}&activityId={activityId}&pageUrl={quote_plus(activityUrl)}&subType=app&adSource=null"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def getSystime():
|
||||
url = "https://lzdz1-isv.isvjcloud.com/common/getSystime"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Cookie': activityCookie,
|
||||
'Content-Length': '0',
|
||||
'Connection': 'keep-alive',
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
refresh_cookies(response)
|
||||
|
||||
def getUserInfo(pin):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/wxActionCommon/getUserInfo"
|
||||
payload = f"pin={quote_plus(pin)}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']['nickname'], res['data']['yunMidImageUrl'], res['data']['pin']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def activityContent(pin, pinImg, nickname):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activityContent"
|
||||
try:
|
||||
yunMidImageUrl = quote_plus(pinImg)
|
||||
except:
|
||||
yunMidImageUrl = quote_plus("https://img10.360buyimg.com/imgzone/jfs/t1/21383/2/6633/3879/5c5138d8E0967ccf2/91da57c5e2166005.jpg")
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}&pinImg={yunMidImageUrl}&nick={quote_plus(nickname)}&cjyxPin=&cjhyPin=&shareUuid={shareUuid}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToken={token};{activityCookie}'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
if "活动已结束" in res['errorMessage']:
|
||||
sys.exit()
|
||||
|
||||
def shareRecord(pin, actorUuid):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/shareRecord"
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}&uuid={actorUuid}&num=30"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def taskRecord(pin, actorUuid):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/taskRecord"
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}&uuid={actorUuid}&taskType="
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
refresh_cookies(response)
|
||||
|
||||
def drawContent(actorUuid, pin):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/taskact/common/drawContent"
|
||||
payload = f"activityId={actorUuid}&pin={quote_plus(pin)}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
requests.request("POST", url, headers=headers, data=payload)
|
||||
|
||||
def taskInfo(pin):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/taskInfo"
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def assist(pin, uuid):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/assist"
|
||||
payload = f"activityId={activityId}&pin={quote_plus(pin)}&uuid={uuid}&shareUuid={shareUuid}"
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
if res['result']:
|
||||
return res['data']
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def doTask(actorUuid, pin, taskType):
|
||||
url = "https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/doTask"
|
||||
payload = f"activityId={activityId}&uuid={actorUuid}&pin={quote_plus(pin)}&taskType={taskType}&taskValue="
|
||||
headers = {
|
||||
'Host': 'lzdz1-isv.isvjcloud.com',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Origin': 'https://lzdz1-isv.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': activityCookie
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
print('doTask', res)
|
||||
if res['result']:
|
||||
data = res['data']
|
||||
if data['score'] == 0:
|
||||
print("\t获得 💨💨💨")
|
||||
else:
|
||||
print(f"\t🎉获得{data['score']}积分")
|
||||
else:
|
||||
print(res['errorMessage'])
|
||||
|
||||
def bindWithVender(cookie, venderId):
|
||||
try:
|
||||
s.headers = {
|
||||
'Connection': 'keep-alive',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'User-Agent': ua,
|
||||
'Cookie': cookie,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Referer': 'https://shopmember.m.jd.com/',
|
||||
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
||||
'Accept': '*/*'
|
||||
}
|
||||
s.params = {
|
||||
'appid': 'jd_shop_member',
|
||||
'functionId': 'bindWithVender',
|
||||
'body': json.dumps({
|
||||
'venderId': venderId,
|
||||
'shopId': venderId,
|
||||
'bindByVerifyCodeFlag': 1
|
||||
}, separators=(',', ':'))
|
||||
}
|
||||
res = s.post('https://api.m.jd.com/', verify=False, timeout=30).json()
|
||||
if res['success']:
|
||||
return res['message']
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def getShopOpenCardInfo(cookie, venderId):
|
||||
shopcard_url0 = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/7854908?activityId={activityId}&shareUuid={shareUuid}"
|
||||
shopcard_url = f"https://shopmember.m.jd.com/shopcard/?venderId={venderId}&channel=401&returnUrl={quote_plus(shopcard_url0)}"
|
||||
try:
|
||||
body = {"venderId": str(venderId), "channel": "401"}
|
||||
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': shopcard_url,
|
||||
'Accept-Encoding': 'gzip, deflate'
|
||||
}
|
||||
response = requests.get(url=url, headers=headers, timeout=5).text
|
||||
res = json.loads(response)
|
||||
if res['success']:
|
||||
venderCardName = res['result']['shopMemberCardInfo']['venderCardName']
|
||||
return venderCardName
|
||||
else:
|
||||
return venderId
|
||||
except:
|
||||
return venderId
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
r = redis_conn()
|
||||
try:
|
||||
cks = getCk
|
||||
if not cks:
|
||||
sys.exit()
|
||||
except:
|
||||
print("未获取到有效COOKIE,退出程序!")
|
||||
sys.exit()
|
||||
global shareUuid, inviteSuccNum, activityUrl, firstCk
|
||||
inviteSuccNum = 0
|
||||
shareUuid = remote_redis(f"lzdz1_{activityId}", 2)
|
||||
activityUrl = f"https://lzdz1-isv.isvjcloud.com/dingzhi/joinCommon/activity/5929859?activityId={activityId}&shareUuid={shareUuid}&adsource=null&shareuserid4minipg=null&lng=00.000000&lat=00.000000&sid=&un_area=&&shopid={shopId}"
|
||||
num = 0
|
||||
for cookie in cks:
|
||||
num += 1
|
||||
if num == 1:
|
||||
firstCk = cookie
|
||||
if num % 10 == 0:
|
||||
print("⏰等待10s,休息一下")
|
||||
time.sleep(6)
|
||||
global ua, activityCookie, token
|
||||
ua = userAgent()
|
||||
try:
|
||||
pt_pin = re.compile(r'pt_pin=(.*?);').findall(cookie)[0]
|
||||
pt_pin = unquote_plus(pt_pin)
|
||||
except IndexError:
|
||||
pt_pin = f'用户{num}'
|
||||
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||
print(datetime.now())
|
||||
|
||||
token = getToken(cookie, r)
|
||||
if token is None:
|
||||
if num == 1:
|
||||
print(f"⚠️车头获取Token失败,退出本程序!")
|
||||
sys.exit()
|
||||
print(f"⚠️获取Token失败!⏰等待3s")
|
||||
time.sleep(3)
|
||||
continue
|
||||
time.sleep(0.5)
|
||||
activityCookie = getActivity()
|
||||
time.sleep(0.5)
|
||||
getSystemConfigForNew()
|
||||
time.sleep(0.3)
|
||||
getSimAct = getSimpleActInfoVo()
|
||||
if getSimAct:
|
||||
venderId = getSimAct['venderId']
|
||||
else:
|
||||
venderId = shopId
|
||||
time.sleep(0.2)
|
||||
getPin = getMyPing(num, venderId)
|
||||
if getPin is not None:
|
||||
nickname = getPin[0]
|
||||
secretPin = getPin[1]
|
||||
time.sleep(0.5)
|
||||
accessLogWithAD(venderId, secretPin)
|
||||
time.sleep(0.5)
|
||||
userInfo = getUserInfo(secretPin)
|
||||
time.sleep(0.8)
|
||||
nickname = userInfo[0]
|
||||
yunMidImageUrl = userInfo[1]
|
||||
pin = userInfo[2]
|
||||
actContent = activityContent(pin, yunMidImageUrl, nickname)
|
||||
if not actContent:
|
||||
if num == 1:
|
||||
print("⚠️无法获取车头邀请码,退出本程序!")
|
||||
sys.exit()
|
||||
continue
|
||||
hasEnd = actContent['hasEnd']
|
||||
if hasEnd:
|
||||
print("活动已结束,下次早点来~")
|
||||
sys.exit()
|
||||
print(f"✅开启【{actContent['activityName']}】活动\n")
|
||||
actorUuid = actContent['actorInfo']['uuid']
|
||||
taskType = actContent['taskType']
|
||||
time.sleep(0.5)
|
||||
shareRecord(pin, actorUuid)
|
||||
time.sleep(0.5)
|
||||
taskRecord(pin, actorUuid)
|
||||
time.sleep(0.5)
|
||||
print("现在去一键关注店铺")
|
||||
doTask(actorUuid, pin, 20)
|
||||
time.sleep(1)
|
||||
doTask(actorUuid, pin, 23)
|
||||
time.sleep(1)
|
||||
ass0 = assist(pin, actorUuid)
|
||||
assistState0 = ass0['assistState']
|
||||
openAll0 = ass0['openCardInfo']['openAll']
|
||||
openVenderId0 = ass0['openCardInfo']['openVenderId']
|
||||
assStat = False
|
||||
if openAll0:
|
||||
print("已完成全部开卡任务")
|
||||
if assistState0 == 0:
|
||||
print("已经助力过你~")
|
||||
# elif assistState0 == 0:
|
||||
# print("无法助力自己~")
|
||||
elif assistState0 == 3:
|
||||
print("已助力过其他好友~")
|
||||
elif assistState0 == 1:
|
||||
print("已完成开卡关注任务,未助力过好友~")
|
||||
assStat = True
|
||||
else:
|
||||
# print('assistStatus:', assistState0)
|
||||
assStat = True
|
||||
else:
|
||||
print("现在去开卡")
|
||||
task_info0 = taskInfo(pin)
|
||||
openCardList = task_info0['1']['settingInfo']
|
||||
openCardLists = [(int(i['value']), i['name']) for i in openCardList]
|
||||
unOpenCardLists = [i for i in openCardLists if i[0] not in openVenderId0]
|
||||
for shop in unOpenCardLists:
|
||||
print(f"去开卡 {shop[0]}")
|
||||
venderId = shop[0]
|
||||
venderCardName = shop[1]
|
||||
getShopOpenCardInfo(cookie, venderId)
|
||||
open_result = bindWithVender(cookie, venderId)
|
||||
if open_result is not None:
|
||||
if "火爆" in open_result or "失败" in open_result or "解绑" in open_result:
|
||||
print(f"\t⛈⛈{venderCardName} {open_result}")
|
||||
assStat = False
|
||||
break
|
||||
else:
|
||||
print(f"\t🎉🎉{venderCardName} {open_result}")
|
||||
assStat = True
|
||||
time.sleep(1.5)
|
||||
activityContent(pin, yunMidImageUrl, nickname)
|
||||
shareRecord(pin, actorUuid)
|
||||
time.sleep(0.5)
|
||||
taskRecord(pin, actorUuid)
|
||||
time.sleep(0.5)
|
||||
ass1 = assist(pin, actorUuid)
|
||||
assistState1 = ass1['assistState']
|
||||
if assStat and assistState1 == 1:
|
||||
pass
|
||||
|
||||
time.sleep(3)
|
@ -1,661 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
File: jd_phoneDiscount.py(手机折上折抽奖)
|
||||
Author: HarbourJ
|
||||
Date: 2022/12/29 20:00
|
||||
TG: https://t.me/HarbourToulu
|
||||
cron: 1 1 1 1 1 1
|
||||
new Env('手机折上折抽奖');
|
||||
活动入口: https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id=63ad1171068bd98098&source=test&baseInfo=LM6HIKdH%2Cbrand_two
|
||||
"""
|
||||
|
||||
|
||||
import time, requests, sys, re, os, json, random
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
from functools import partial
|
||||
print = partial(print, flush=True)
|
||||
|
||||
try:
|
||||
from jd_sign import *
|
||||
except ImportError as e:
|
||||
print(e)
|
||||
if "No module" in str(e):
|
||||
print("请先运行Faker库依赖一键安装脚本(jd_check_dependent.py),安装jd_sign.so依赖")
|
||||
sys.exit()
|
||||
try:
|
||||
from jdCookie import get_cookies
|
||||
getCk = get_cookies()
|
||||
except:
|
||||
print("请先下载依赖脚本,\n下载链接: https://raw.githubusercontent.com/HarbourJ/HarbourToulu/main/jdCookie.py")
|
||||
sys.exit(3)
|
||||
|
||||
redis_url = os.environ.get("redis_url") if os.environ.get("redis_url") else "172.17.0.1"
|
||||
redis_port = os.environ.get("redis_port") if os.environ.get("redis_port") else "6379"
|
||||
redis_pwd = os.environ.get("redis_pwd") if os.environ.get("redis_pwd") else ""
|
||||
baseInfo = os.environ.get("baseInfo") if os.environ.get("baseInfo") else ""
|
||||
|
||||
if not baseInfo:
|
||||
print('未设置export baseInfo="品牌编号",默认运行第九个任务brand_ten')
|
||||
baseInfo = "8AHIKfsi%2Cbrand_ten"
|
||||
else:
|
||||
if baseInfo == "1":
|
||||
baseInfo = "HXu94GdF%2Cbrand_one"
|
||||
elif baseInfo == "2":
|
||||
baseInfo = "LM6HIKdH%2Cbrand_two"
|
||||
elif baseInfo == "3":
|
||||
baseInfo = "KmwM4N4L%2Cbrand_three"
|
||||
elif baseInfo == "4":
|
||||
baseInfo = "8pTg6fXi%2Cbrand_four"
|
||||
elif baseInfo == "5":
|
||||
baseInfo = "Sr5zisvb%2Cbrand_five"
|
||||
elif baseInfo == "6":
|
||||
baseInfo = "B0cRJYyC%2Cbrand_six"
|
||||
elif baseInfo == "7":
|
||||
baseInfo = "ZRco56US%2Cbrand_seven"
|
||||
elif baseInfo == "8":
|
||||
baseInfo = "4tqyLzac%2Cbrand_eight"
|
||||
elif baseInfo == "9":
|
||||
baseInfo = "PIZ1W0ap%2Cbrand_nine"
|
||||
elif baseInfo == "10":
|
||||
baseInfo = "8AHIKfsi%2Cbrand_ten"
|
||||
elif baseInfo == "11":
|
||||
baseInfo = "zvNssjdW%2Cbrand_eleven"
|
||||
else:
|
||||
print('export baseInfo="品牌编号"设置有误,默认运行第九个任务brand_ten')
|
||||
baseInfo = "8AHIKfsi%2Cbrand_ten"
|
||||
appKey = baseInfo.split('%2C')[0]
|
||||
brand = baseInfo.split('%2C')[1]
|
||||
|
||||
activity_url = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id=63ad1171068bd98098&source=test&baseInfo={baseInfo}"
|
||||
print(f"【🛳活动入口】{activity_url}")
|
||||
|
||||
def redis_conn():
|
||||
try:
|
||||
import redis
|
||||
try:
|
||||
pool = redis.ConnectionPool(host=redis_url, port=redis_port, decode_responses=True, socket_connect_timeout=5, password=redis_pwd)
|
||||
r = redis.Redis(connection_pool=pool)
|
||||
r.get('conn_test')
|
||||
print('✅redis连接成功')
|
||||
return r
|
||||
except:
|
||||
print("⚠️redis连接异常")
|
||||
except:
|
||||
print("⚠️缺少redis依赖,请运行pip3 install redis")
|
||||
sys.exit()
|
||||
|
||||
def getToken(ck, r=None):
|
||||
host = f'{activityUrl.split("com/")[0]}com'
|
||||
try:
|
||||
pt_pin = unquote_plus(re.compile(r'pt_pin=(.*?);').findall(ck)[0])
|
||||
except:
|
||||
pt_pin = ck[:15]
|
||||
try:
|
||||
try:
|
||||
Token = r.get(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}')
|
||||
except Exception as e:
|
||||
Token = None
|
||||
if Token is not None:
|
||||
print(f"♻️获取缓存Token")
|
||||
return Token
|
||||
else:
|
||||
s.headers = {
|
||||
'Connection': 'keep-alive',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'User-Agent': '',
|
||||
'Cookie': ck,
|
||||
'Host': 'api.m.jd.com',
|
||||
'Referer': '',
|
||||
'Accept-Language': 'zh-Hans-CN;q=1 en-CN;q=0.9',
|
||||
'Accept': '*/*'
|
||||
}
|
||||
sign({"url": f"{host}", "id": ""}, 'isvObfuscator')
|
||||
f = s.post('https://api.m.jd.com/client.action', verify=False, timeout=30)
|
||||
if f.status_code != 200:
|
||||
print(f.status_code)
|
||||
return
|
||||
else:
|
||||
if "参数异常" in f.text:
|
||||
print(f.text)
|
||||
return
|
||||
Token_new = f.json()['token']
|
||||
try:
|
||||
if r.set(f'{activityUrl.split("https://")[1].split("-")[0]}_{pt_pin}', Token_new, ex=1800):
|
||||
print("✅Token缓存成功")
|
||||
else:
|
||||
print("❌Token缓存失败")
|
||||
except Exception as e:
|
||||
print(f"✅获取实时Token")
|
||||
return Token_new
|
||||
except Exception as e:
|
||||
print(f"Token error: {str(e)}")
|
||||
return
|
||||
|
||||
def getJdTime():
|
||||
url = "http://api.m.jd.com/client.action?functionId=queryMaterialProducts&client=wh5"
|
||||
headers = {
|
||||
'Accept': '*/*',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||
'Host': 'api.m.jd.com',
|
||||
'Proxy-Connection': 'keep-alive',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
|
||||
}
|
||||
try:
|
||||
response = requests.request("GET", url, headers=headers, timeout=2)
|
||||
if response.status_code == 200:
|
||||
res = response.json()
|
||||
jdTime = res['currentTime2']
|
||||
except:
|
||||
jdTime = int(round(time.time() * 1000))
|
||||
return jdTime
|
||||
|
||||
def randomString(e, flag=False):
|
||||
t = "0123456789abcdef"
|
||||
if flag: t = t.upper()
|
||||
n = [random.choice(t) for _ in range(e)]
|
||||
return ''.join(n)
|
||||
|
||||
def refresh_cookies(res):
|
||||
if res.cookies:
|
||||
cookies = res.cookies.get_dict()
|
||||
set_cookie = [(set_cookie + "=" + cookies[set_cookie]) for set_cookie in cookies]
|
||||
global activityCookie
|
||||
activityCookieMid = [i for i in activityCookie.split(';') if i != '']
|
||||
for i in activityCookieMid:
|
||||
for x in set_cookie:
|
||||
if i.split('=')[0] == x.split('=')[0]:
|
||||
if i.split('=')[1] != x.split('=')[1]:
|
||||
activityCookieMid.remove(i)
|
||||
activityCookie = ''.join(
|
||||
sorted([(set_cookie + ";") for set_cookie in list(set(activityCookieMid + set_cookie))]))
|
||||
# print("刷新cookie", activityCookie)
|
||||
|
||||
def getActivity():
|
||||
url = activityUrl
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'User-Agent': ua,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Connection': 'keep-alive',
|
||||
'Referer': activityUrl,
|
||||
'Cookie': f'IsvToen={token}'
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
if response.status_code == 200:
|
||||
return
|
||||
else:
|
||||
print(response.status_code)
|
||||
print("⚠️疑似ip黑了")
|
||||
sys.exit()
|
||||
|
||||
def getAuth():
|
||||
url = f"https://sjtx-dz.isvjcloud.com/auth/jos?token={token}&jd_source=01&source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
if res['status'] == 0:
|
||||
return res['body']['access_token']
|
||||
else:
|
||||
print(f"⚠️{res}")
|
||||
|
||||
def getUserInfo(authToken):
|
||||
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/get_user_info?source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
res = response.json()
|
||||
try:
|
||||
code = res['code']
|
||||
is_acvite_complete = res['is_acvite_complete']
|
||||
user_click_invite = res['user_click_invite']
|
||||
is_invite_complete = res['is_invite_complete']
|
||||
user_new = res['user_new']
|
||||
return code, is_acvite_complete, user_click_invite, is_invite_complete, user_new
|
||||
except:
|
||||
print(res)
|
||||
|
||||
def getFriendList(authToken):
|
||||
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/get_friend_list?source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
res = response.json()
|
||||
# print("getFriendList:", res)
|
||||
try:
|
||||
friendList = res['friend_list']
|
||||
except Exception as e:
|
||||
print(f"getFriendList Error: {str(e)}")
|
||||
friendList = []
|
||||
return friendList
|
||||
|
||||
def inviteFriend(inviter_id, authToken):
|
||||
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/invite_friend?source=test&is_share=1"
|
||||
payload = '{"inviter_id":"' + inviter_id + '","channel":2}'
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def invite(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/burying/stat?action=invite&source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def inviteFriendNew(inviter_id, authToken):
|
||||
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/invite_friend_new?source=test&is_share=1"
|
||||
payload = '{"inviter_id":"' + inviter_id + '","channel":2}'
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def clickHomeGetPrize(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/burying/stat?action=click_home_get_prize&source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def clickEffectGetPrize(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/burying/stat?action=click_effect_get_prize&source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def homeSendPrizes(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/phone-discount-api/home_send_prizes?source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def clickCouponSenPrize(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/burying/stat?action=click_coupon_send_prize&source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
def userClickInvite(authToken):
|
||||
url = f"https://sjtx-dz.isvjcloud.com/phone-discount-api/user_click_invite?source=test&is_share=1"
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
requests.request("POST", url, headers=headers)
|
||||
|
||||
def inviteDrawPrize(invite_type, authToken):
|
||||
url = "https://sjtx-dz.isvjcloud.com/phone-discount-api/invite_draw_prize?source=test&is_share=1"
|
||||
payload = '{"invite_type":' + invite_type + '}'
|
||||
headers = {
|
||||
'Host': 'sjtx-dz.isvjcloud.com',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'App-Key': appKey,
|
||||
'Authorization': f'Bearer {authToken}',
|
||||
'brand': brand,
|
||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': 'application/json',
|
||||
'Origin': 'https://sjtx-dz.isvjcloud.com',
|
||||
'User-Agent': ua,
|
||||
'Referer': activityUrl,
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
response = requests.request("POST", url, headers=headers, data=payload)
|
||||
res = response.json()
|
||||
return res
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
r = redis_conn()
|
||||
try:
|
||||
cks = getCk
|
||||
if not cks:
|
||||
sys.exit()
|
||||
except:
|
||||
print("未获取到有效COOKIE,退出程序!")
|
||||
sys.exit()
|
||||
global shareUuid, inviteSuccNum, activityUrl, firstCk, allCookies
|
||||
inviteSuccNum = 0
|
||||
try:
|
||||
shareUuid = remote_redis(brand, 1)
|
||||
if not shareUuid:
|
||||
shareUuid = "63ad1171068bd98098"
|
||||
except:
|
||||
shareUuid = "63ad1171068bd98098"
|
||||
activityUrl = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id={shareUuid}&source=test&baseInfo={baseInfo}"
|
||||
allCookies = cks
|
||||
|
||||
num = 0
|
||||
for cookie in allCookies:
|
||||
num += 1
|
||||
if num == 1:
|
||||
firstCk = cookie
|
||||
if num % 6 == 0:
|
||||
print("⏰等待3s,休息一下")
|
||||
time.sleep(3)
|
||||
global ua, activityCookie, token
|
||||
ua = userAgent()
|
||||
try:
|
||||
pt_pin = re.compile(r'pt_pin=(.*?);').findall(cookie)[0]
|
||||
pt_pin = unquote_plus(pt_pin)
|
||||
except IndexError:
|
||||
pt_pin = re.compile(r'pin=(.*?);').findall(cookie)[0]
|
||||
pt_pin = unquote_plus(pt_pin)
|
||||
print(f'\n******开始【京东账号{num}】{pt_pin} *********\n')
|
||||
|
||||
print(datetime.now())
|
||||
token = None
|
||||
token = getToken(cookie, r)
|
||||
if token is None:
|
||||
if num == 1:
|
||||
print(f"⚠️车头获取Token失败,退出本程序!")
|
||||
sys.exit()
|
||||
print(f"⚠️获取Token失败!⏰等待3s")
|
||||
time.sleep(3)
|
||||
continue
|
||||
time.sleep(0.3)
|
||||
getActivity()
|
||||
time.sleep(0.2)
|
||||
authToken = getAuth()
|
||||
if not authToken:
|
||||
if num == 1:
|
||||
print("‼️车头为火爆号,换车头重新运行!")
|
||||
sys.exit()
|
||||
else:
|
||||
print("📝移除火爆账号")
|
||||
allCKs.remove()
|
||||
time.sleep(1.5)
|
||||
continue
|
||||
time.sleep(0.2)
|
||||
userInfo = getUserInfo(authToken)
|
||||
if not userInfo:
|
||||
if num == 1:
|
||||
sys.exit()
|
||||
else:
|
||||
time.sleep(1.5)
|
||||
continue
|
||||
shareUuid1 = userInfo[0]
|
||||
print(f"🤖助力码: {shareUuid1}")
|
||||
is_acvite_complete = userInfo[1]
|
||||
user_new = userInfo[4]
|
||||
time.sleep(0.2)
|
||||
if num == 1:
|
||||
inviteSuccNum = len(getFriendList(authToken))
|
||||
print(f"🧑🤝🧑CK1已邀请{inviteSuccNum}人")
|
||||
if inviteSuccNum >= 10:
|
||||
for i in range(2):
|
||||
invite_type = i + 1
|
||||
print(f"开始第{invite_type}次抽奖")
|
||||
drawPrize = inviteDrawPrize(str(invite_type), authToken)
|
||||
try:
|
||||
if "prize_info" not in drawPrize:
|
||||
print(drawPrize['message'])
|
||||
else:
|
||||
prize_info = f"{drawPrize['prize_info']['user_prize']['prize_name']} {drawPrize['prize_info']['user_prize']['prize_info']['quota']}"
|
||||
print(f"🎁抽奖获得:{prize_info}")
|
||||
except:
|
||||
print(f"抽奖结果: {drawPrize}")
|
||||
sys.exit()
|
||||
time.sleep(0.2)
|
||||
if user_new == 1: # 新用户
|
||||
invite(authToken)
|
||||
time.sleep(0.2)
|
||||
inviteNewInfo = inviteFriendNew(shareUuid, authToken)
|
||||
if "prize_info" in inviteNewInfo:
|
||||
prize_info = [f"{x['user_prize']['prize_name']}{x['user_prize']['prize_info']['quota']}个" for x in inviteNewInfo['prize_info']]
|
||||
if prize_info:
|
||||
print(f"🎁获得{','.join(prize_info)}")
|
||||
else:
|
||||
print("来晚了没水了💨💨💨")
|
||||
inviteSuccNum += 1
|
||||
print(f"🎉助力成功!已邀请{inviteSuccNum}人")
|
||||
else:
|
||||
print(inviteNewInfo['message'])
|
||||
clickHomeGetPrize(authToken)
|
||||
time.sleep(0.2)
|
||||
clickEffectGetPrize(authToken)
|
||||
time.sleep(0.2)
|
||||
homePrizes = homeSendPrizes(authToken)
|
||||
if "prize_info" in homePrizes:
|
||||
prize_info = [f"{x['user_prize']['prize_name']}{x['user_prize']['prize_info']['quota']}个" for x in homePrizes['prize_info']]
|
||||
print(f"🎁获得{','.join(prize_info)}")
|
||||
else:
|
||||
print(homePrizes)
|
||||
time.sleep(0.2)
|
||||
userClickInvite(authToken)
|
||||
|
||||
if inviteSuccNum >= 10:
|
||||
token = getToken(firstCk, r)
|
||||
time.sleep(0.2)
|
||||
getActivity()
|
||||
time.sleep(0.2)
|
||||
authToken0 = getAuth()
|
||||
time.sleep(0.2)
|
||||
getUserInfo(authToken0)
|
||||
time.sleep(0.2)
|
||||
for i in range(2):
|
||||
invite_type = i + 1
|
||||
print(f"开始第{invite_type}次抽奖")
|
||||
drawPrize0 = inviteDrawPrize(str(invite_type), authToken0)
|
||||
try:
|
||||
if "prize_info" not in drawPrize0:
|
||||
print(drawPrize0['message'])
|
||||
else:
|
||||
prize_info = f"{drawPrize0['prize_info']['user_prize']['prize_name']}{drawPrize0['prize_info']['user_prize']['prize_info']['quota']}"
|
||||
print(f"🎁抽奖获得:{prize_info}")
|
||||
except:
|
||||
print(drawPrize0)
|
||||
sys.exit()
|
||||
else:
|
||||
inviteInfo = inviteFriend(shareUuid, authToken)
|
||||
if "prize_info" not in inviteInfo:
|
||||
print(inviteInfo['message'])
|
||||
if "已达到好友邀请上限" in inviteInfo['message']:
|
||||
if num == 1:
|
||||
shareUuid = shareUuid1
|
||||
activityUrl = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id={shareUuid}&source=test&baseInfo={baseInfo}"
|
||||
print(f"🤖后面的号全部助力: {shareUuid}")
|
||||
continue
|
||||
else:
|
||||
token = getToken(firstCk, r)
|
||||
time.sleep(0.2)
|
||||
getActivity()
|
||||
time.sleep(0.2)
|
||||
authToken0 = getAuth()
|
||||
time.sleep(0.2)
|
||||
getUserInfo(authToken0)
|
||||
time.sleep(0.2)
|
||||
for i in range(2):
|
||||
invite_type = i + 1
|
||||
print(f"开始第{invite_type}次抽奖")
|
||||
drawPrize0 = inviteDrawPrize(str(invite_type), authToken0)
|
||||
try:
|
||||
if "prize_info" not in drawPrize0:
|
||||
print(drawPrize0['message'])
|
||||
else:
|
||||
prize_info = f"{drawPrize0['prize_info']['user_prize']['prize_name']}{drawPrize0['prize_info']['user_prize']['prize_info']['quota']}"
|
||||
print(f"🎁抽奖获得:{prize_info}")
|
||||
except:
|
||||
print(drawPrize0)
|
||||
sys.exit()
|
||||
else:
|
||||
inviteSuccNum += 1
|
||||
print(f"🎉助力成功!已邀请{inviteSuccNum}人")
|
||||
prize_info = [f"{x['user_prize']['prize_name']}{x['user_prize']['prize_info']['quota']}个" for x in inviteInfo['prize_info']]
|
||||
print(f"🎁获得{','.join(prize_info)}")
|
||||
if inviteSuccNum >= 10:
|
||||
token = getToken(firstCk, r)
|
||||
time.sleep(0.2)
|
||||
getActivity()
|
||||
time.sleep(0.2)
|
||||
authToken0 = getAuth()
|
||||
time.sleep(0.2)
|
||||
getUserInfo(authToken0)
|
||||
time.sleep(0.2)
|
||||
for i in range(2):
|
||||
invite_type = i + 1
|
||||
print(f"开始第{invite_type}次抽奖")
|
||||
drawPrize0 = inviteDrawPrize(str(invite_type), authToken0)
|
||||
try:
|
||||
if "prize_info" not in drawPrize0:
|
||||
print(drawPrize0['message'])
|
||||
else:
|
||||
prize_info = f"{drawPrize0['prize_info']['user_prize']['prize_name']}{drawPrize0['prize_info']['user_prize']['prize_info']['quota']}"
|
||||
print(f"🎁抽奖获得:{prize_info}")
|
||||
except:
|
||||
print(drawPrize0)
|
||||
sys.exit()
|
||||
if num == 1:
|
||||
shareUuid = shareUuid1
|
||||
activityUrl = f"https://sjtx-dz.isvjcloud.com/phone_discount/?invite_id={shareUuid}&source=test&baseInfo={baseInfo}"
|
||||
print(f"🤖后面的号全部助力: {shareUuid}")
|
||||
|
||||
time.sleep(2)
|
File diff suppressed because one or more lines are too long
32
jd_qbyql.js
32
jd_qbyql.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
253
jd_tanwei.js
253
jd_tanwei.js
File diff suppressed because one or more lines are too long
302
jd_twjk_new.js
302
jd_twjk_new.js
File diff suppressed because one or more lines are too long
19
jd_xkmh.js
19
jd_xkmh.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user