This commit is contained in:
Faker 2022-08-15 07:37:12 +08:00
parent 08219446a1
commit e85aa663bf
19 changed files with 1524 additions and 1272 deletions

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

View File

@ -1,13 +1,11 @@
/*
清空购物车
更新时间2022-05-26
更新时间2022-08-12
因其他脚本会加入商品到购物车故此脚本用来清空购物车
包括预售
需要算法支持
默认不执行 如需要请添加环境变量
gua_cleancart_Run="true"
gua_cleancart_SignUrl="" # 算法url
gua_cleancart_Authorization="" # 算法url token 有则填
JD_CART_REMOVE="true"
1.@&@ 前面加数字 指定账号pin
@ -20,7 +18,7 @@ gua_cleancart_Authorization="" # 算法url token 有则填
7.|-| 👉 账号之间隔开
商品名称规则
商品名称规则,默认所有账号全清空
gua_cleancart_products
pin2@&@商品1,商品2👉该pin这几个商品名不清空
pin5@&@👉该pin全清
@ -35,13 +33,17 @@ pin3@&@不清空👉该pin不清空
如果有不清空的一定要加上"*@&@不清空"
防止没指定的账号购物车全清空
cron:8 8 8 8 *
============Quantumultx===============
[task_local]
#清空购物车-Sign版
8 8 8 8 * jd_cleancart_nolan.js, tag=清空购物车-Sign版, enabled=true
*/
let jdSignUrl = '' // 算法url
let Authorization = '' // 算法url token 有则填
let jdSignUrl = 'https://api.nolanstore.top/sign'
let cleancartRun = 'false'
let cleancartProducts = ''
const $ = new Env('清空购物车');
const $ = new Env('清空购物车-Sign版');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const notify = $.isNode() ? require('./sendNotify') : '';
//IOS等用户直接用NobyDa的jd cookie
@ -58,14 +60,9 @@ if ($.isNode()) {
message = ''
jdSignUrl = $.isNode() ? (process.env.gua_cleancart_SignUrl ? process.env.gua_cleancart_SignUrl : `${jdSignUrl}`) : ($.getdata('gua_cleancart_SignUrl') ? $.getdata('gua_cleancart_SignUrl') : `${jdSignUrl}`);
cleancartRun = $.isNode() ? (process.env.JD_CART_REMOVE ? process.env.JD_CART_REMOVE : `${cleancartRun}`) : ($.getdata('JD_CART_REMOVE') ? $.getdata('JD_CART_REMOVE') : `${cleancartRun}`);
Authorization = process.env.gua_cleancart_Authorization ? process.env.gua_cleancart_Authorization : `${Authorization}`
if(Authorization && Authorization.indexOf("Bearer ") === -1) Authorization = `Bearer ${Authorization}`
cleancartRun = $.isNode() ? (process.env.gua_cleancart_Run ? process.env.gua_cleancart_Run : `${cleancartRun}`) : ($.getdata('gua_cleancart_Run') ? $.getdata('gua_cleancart_Run') : `${cleancartRun}`);
cleancartProducts = $.isNode() ? (process.env.gua_cleancart_products ? process.env.gua_cleancart_products : `${cleancartProducts}`) : ($.getdata('gua_cleancart_products') ? $.getdata('gua_cleancart_products') : `${cleancartProducts}`);
cleancartProducts = $.isNode() ? (process.env.gua_cleancart_products ? process.env.gua_cleancart_products : '*@&@') : ($.getdata('gua_cleancart_products') ? $.getdata('gua_cleancart_products') : `${cleancartProducts}`);
let productsArr = []
let cleancartProductsAll = []
@ -81,6 +78,7 @@ for (let i in productsArr) {
cleancartProductsAll[arr[0]] = arr[1].split(',')
}
}
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
@ -89,20 +87,22 @@ for (let i in productsArr) {
return;
}
if(cleancartRun !== 'true'){
console.log('脚本停止\n请添加环境变量[gua_cleancart_Run]为"true"')
console.log('脚本停止\n请添加环境变量JD_CART_REMOVE为"true"')
return
}
if(!cleancartProducts){
console.log('脚本停止\n请添加环境变量[gua_cleancart_products]\n清空商品\n内容规则看脚本文件')
return
}
$.out = false
console.log('\n==此脚本使用的签名接口来自Nolan提供的公益服务,大伙记得给他点赞==');
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if(cleancartProductsAll[$.UserName]){
$.cleancartProductsArr = cleancartProductsAll[$.UserName]
}else if(cleancartProductsAll["*"]){
@ -218,10 +218,7 @@ async function run(){
if(msg){
message += `【京东账号${$.index}${$.nickName || $.UserName}\n${msg}\n`
}
if(!$.out){
console.log('等待45秒')
await $.wait(parseInt(Math.random() * 2000 + 40000, 10))
}
await $.wait(parseInt(Math.random() * 2000 + 2000, 10))
}catch(e){
console.log(e)
}
@ -246,15 +243,11 @@ function jdApi(functionId,body) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// console.log(data)
let res = $.toObj(data,data);
if(typeof res == 'object'){
if(res.mainTitle) console.log(res.mainTitle)
if(res.resultCode == 0){
resolve(res);
}else if (res.tips && res.tips.includes("正在努力加载")){
console.log("请求太快ip被限制了")
$.out = true
}
}
}
@ -267,61 +260,61 @@ function jdApi(functionId,body) {
})
}
function jdSign(fn,body) {
let sign = ''
let flag = false
try{
const fs = require('fs');
if (fs.existsSync('./gua_encryption_sign.js')) {
const encryptionSign = require('./gua_encryption_sign');
sign = encryptionSign.getSign(fn, body)
}else{
flag = true
}
sign = sign.data && sign.data.sign && sign.data.sign || ''
}catch(e){
flag = true
}
if(!flag) return sign
if(!jdSignUrl.match(/^https?:\/\//)){
console.log('请填写算法url')
$.out = true
return ''
}
return new Promise((resolve) => {
let options = {
url: jdSignUrl,
body:`{"fn":"${fn}","body":${body}}`,
followRedirect:false,
headers: {
'Accept':'*/*',
"accept-encoding": "gzip, deflate, br",
'Content-Type': 'application/json',
},
timeout:30000
}
if(Authorization) options["headers"]["Authorization"] = Authorization
$.post(options, async (err, resp, data) => {
try {
// console.log(data)
let res = $.toObj(data,data)
if(typeof res === 'object' && res){
if(res.code && res.code == 200 && res.data){
if(res.data.sign) sign = res.data.sign || ''
if(sign != '') resolve(sign)
}else{
console.log(data)
}
}else{
console.log(data)
function jdSign(fn, body) {
let sign = '';
let flag = false;
try {
const fs = require('fs');
if (fs.existsSync('./gua_encryption_sign.js')) {
const encryptionSign = require('./gua_encryption_sign');
sign = encryptionSign.getSign(fn, body)
} else {
flag = true
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve('')
}
sign = sign.data && sign.data.sign && sign.data.sign || ''
} catch (e) {
flag = true
}
if (!flag)
return sign
if (!jdSignUrl.match(/^https?:\/\//)) {
console.log('请填写算法url')
$.out = true
return ''
}
return new Promise((resolve) => {
let url = {
url: jdSignUrl,
body: `{"fn":"${fn}","body":${body}}`,
followRedirect: false,
headers: {
'Accept': '*/*',
"accept-encoding": "gzip, deflate, br",
'Content-Type': 'application/json'
},
timeout: 30000
}
$.post(url, async(err, resp, data) => {
try {
data = JSON.parse(data);
if (data && data.body) {
if (data.body)
sign = data.body || '';
if (sign != '')
resolve(sign);
else
console.log("签名获取失败.");
} else {
console.log("签名获取失败.");
}
} catch (e) {
$.logErr(e, resp);
}
finally {
resolve('')
}
})
})
})
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,13 +34,13 @@ const token = [
"F33A1D9D66CD2D5DDD1C4FDE085C4EC8",
"DA71409388CE531378225A6BBF96CDFE",
"1D859C8496A1C222746B1474B34D7426",
"89EC96E44D386352EC5EC9F84B21CAAA",
"8C7A8DEAB8A6C8AC98EEE364EBB10F7A",
"3ACBEC88453BD0AEC2B61FC7C59E5128",
"A6D7A29DB6C46B7D3F7CD6EC3AE110C6",
"F9E7DBB640BB2094C6A7755066DCE5CA",
"30D17316E31067004ED239DE9F121B0D",
"A07B0E92FA199CB1EF432D315FFC5F62",
"D35923E942C11178C38BD29E783695B8",
"4E4B5F141AADE9638771B6226AD426D0",
"8C7A8DEAB8A6C8AC98EEE364EBB10F7A",
"8CC487234D54778E2F1C738C79B397BA",
"500B9537712BD828EFC8C4D036B9752A",

File diff suppressed because one or more lines are too long

408
jd_fcwb.py Normal file
View File

@ -0,0 +1,408 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
cron: 1 1 1 1 *
new Env('发财挖宝');
活动入口: 京东极速版 > 我的 > 发财挖宝
最高可得总和为10元的微信零钱和红包
脚本功能为: 挖宝提现没有助力功能当血量剩余 1 时停止挖宝领取奖励并提现
目前需要完成逛一逛任务并且下单任务才能通关不做的话大概可得1.52块的微信零钱
'''
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":840,"channel":4,"itemId":"https%3A%2F%2Fprodev.m.jd.com%2Fjdlite%2Factive%2FeVgKdaU5TKnGZfSWCRe79hqfLXp%2Findex.html","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()

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

25
jd_lzdz1_customizedd.js Normal file

File diff suppressed because one or more lines are too long

8
jd_mpdz_car_task.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let jdNotify = true;
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '', message = '';
let encryptProjectId = '3NhNqgKD5WYkmLLsudX1Z2vVS5pP';
let encryptProjectId = 'YnxEZcUsgLzE5dukqb7vrmjPnaN';
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
@ -63,19 +63,17 @@ async function twqyj() {
let tk = await queryInteractiveInfo();
for (let key of Object.keys(tk.assignmentList).reverse()){
let vo = tk.assignmentList[key]
if (vo.completionFlag && vo.assignmentType != 30) {
if (vo.completionFlag || vo.assignmentType == 30) {
console.log('此任务已完成')
} else if (new Date(vo.assignmentStartTime).getTime() > Date.now()) {
console.log('此任务还没到开放时间:',vo.assignmentStartTime)
} else if (vo.assignmentType == 30) {
await dotask(encryptProjectId,vo.encryptAssignmentId,{"ext":{"exchangeNum":1}})
} else {
if (vo.ext && vo.ext.extraType == 'sign1') {
if (vo.ext && vo.ext.extraType == 'sign1'){
await sign(encryptProjectId,vo.encryptAssignmentId)
} else {
await dotask(encryptProjectId,vo.encryptAssignmentId)
}
}
}
}
await $.wait(1000)
}
} catch (e) {
@ -135,10 +133,9 @@ async function sign(encryptProjectId, AssignmentId) {
})
}
async function dotask(encryptProjectId, AssignmentId, body1 = {}) {
let body = { "encryptProjectId": encryptProjectId, "encryptAssignmentId": AssignmentId, "sourceCode": "acemsg0406", "completionFlag": true,...body1}
async function dotask(encryptProjectId, AssignmentId) {
return new Promise(async (resolve) => {
$.post(taskUrl("doInteractiveAssignment", body), async (err, resp, data) => {
$.post(taskUrl("doInteractiveAssignment", { "encryptProjectId": encryptProjectId, "encryptAssignmentId": AssignmentId, "sourceCode": "acemsg0406", "completionFlag": true }), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)

View File

@ -1,15 +1,20 @@
/*
* 2022-07-20 修复获取试用列表风控问题
* 2022-08-12 修复申请试用风控更换nolan接口
* By https://github.com/6dylan6/jdpro/
* 基于X1a0He版本修改
* 2022-05-27 修复优化版 By https://github.com/6dylan6/jdpro/
* 如需运行请自行添加环境变量JD_TRY值填 true 即可运行
* X1a0He by 6dylan6/jdpro/
* 脚本是否耗时只看args_xh.maxLength的大小
* 上一作者说了每天最多300个商店总上限为500个jd_unsubscribe.js我已更新为批量取关版
* 请提前取关至少250个商店确保京东试用脚本正常运行
* @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js
如需运行请自行添加环境变量JD_TRY="true" 即可运行
脚本是否耗时只看args_xh.maxLength的大小申请数量默认50个申请100个差不多15分钟
上一作者说每天申请上限300个自测没有申请过上限关注店铺上限500个
关注店铺满了就无法继续申请可用批量取关店铺取消关注
部分环境变量说明详细请参考61行往下
部分环境变量说明详细请参考58行往下
export JD_TRY="true"是否允许默认false
export JD_TRY_PASSZC="false" #不过滤种草官类试用默认true过滤
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度默认50个
export JD_TRY_PRICE="XX"#商品原价格大于XX才申请默认20
@ -28,7 +33,7 @@ let trialActivityIdList = []
let trialActivityTitleList = []
let notifyMsg = ''
let size = 1;
let APITOKEN = process.env.APITOKEN || '';
let APITOKEN = process.env.APITOKEN ||'';
$.isPush = true;
$.isLimit = false;
$.isForbidden = false;
@ -40,19 +45,18 @@ $.getNum = 0;
$.try = true;
$.sentNum = 0;
$.cookiesArr = []
//默认的过滤关键词
$.innerKeyWords =
[
"幼儿园", "教程", "英语", "辅导", "培训",
"孩子", "小学", "成人用品", "套套", "情趣",
"自慰", "阳具", "飞机杯", "男士用品", "女士用品",
"内衣", "高潮", "避孕", "乳腺", "肛塞", "肛门",
"宝宝", "芭比", "娃娃", "男用",
"宝宝", "玩具", "芭比", "娃娃", "男用",
"女用", "神油", "足力健", "老年", "老人",
"宠物", "饲料", "丝袜", "黑丝", "磨脚",
"脚皮", "除臭", "性感", "内裤", "跳蛋",
"安全套", "龟头", "阴道", "阴部", "手机卡", "电话卡", "流量卡",
"习题", "试卷",
"玉坠","和田玉","习题","试卷","手机壳","钢化膜"
]
//下面很重要,遇到问题请把下面注释看一遍再来问
let args_xh = {
@ -149,7 +153,7 @@ let args_xh = {
* 例如B商品是种草官专属试用商品下面设置为true即使你是种草官账号A商品也不会被添加到待提交试用组
* 可设置环境变量JD_TRY_PASSZC默认为true
* */
passZhongCao: process.env.JD_TRY_PASSZC === 'false' || true,
passZhongCao: process.env.JD_TRY_PASSZC === 'false' ? false : true,
/*
* 是否打印输出到日志考虑到如果试用组长度过大例如100以上如果每个商品检测都打印一遍日志长度会非常长
* 打印的优点清晰知道每个商品为什么会被过滤哪个商品被添加到了待提交试用组
@ -159,7 +163,7 @@ let args_xh = {
* 不打印的缺点无法清晰知道每个商品为什么会被过滤哪个商品被添加到了待提交试用组
* 可设置环境变量JD_TRY_PLOG默认为true
* */
printLog: process.env.JD_TRY_PLOG === 'false' || true,
printLog: process.env.JD_TRY_PLOG === 'false' ? false : true,
/*
* 白名单是否打开如果下面为true那么黑名单会自动失效
* 白名单和黑名单无法共存白名单永远优先于黑名单
@ -183,56 +187,55 @@ let args_xh = {
!(async () => {
await $.wait(500)
// 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true
if (process.env.JD_TRY && process.env.JD_TRY === 'true') {
$.log('\n遇到问题请先看脚本内注释解决不了可联系https://t.me/dylan_jdpro\n');
await requireConfig()
if (!$.cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
})
return
}
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
for (let i = 0; i < $.cookiesArr.length; i++) {
if ($.cookiesArr[i]) {
$.cookie = $.cookiesArr[i];
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
await totalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
$.except = false;
if (args_xh.except.includes($.UserName)) {
console.log(`跳过账号:${$.nickName || $.UserName}`)
$.except = true;
continue
}
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
continue
}
$.totalTry = 0
$.totalSuccess = 0
$.nowTabIdIndex = 0;
$.nowPage = 1;
$.nowItem = 1;
$.retrynum = 0
$.jda = '__jda=' + _jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
if (!args_xh.unified) {
trialActivityIdList = []
trialActivityTitleList = []
}
$.isLimit = false;
// 获取tabList的不知道有哪些的把这里的注释解开跑一遍就行了
//await try_tabList();
// return;
$.isForbidden = false
$.wrong = false
size = 1
if (1) {
await requireConfig()
if (!$.cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
})
return
}
args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random())
for (let i = 0; i < $.cookiesArr.length; i++) {
if ($.cookiesArr[i]) {
$.cookie = $.cookiesArr[i];
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
//await totalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
$.except = false;
if(args_xh.except.includes($.UserName)){
console.log(`跳过账号:${$.nickName || $.UserName}`)
$.except = true;
continue
}
if(!$.isLogin){
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
continue
}
$.totalTry = 0
$.totalSuccess = 0
$.nowTabIdIndex = 0;
$.nowPage = 1;
$.nowItem = 1;
$.retrynum = 0
$.jda='__jda='+_jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx')
if (!args_xh.unified) {
trialActivityIdList = []
trialActivityTitleList = []
}
$.isLimit = false;
// 获取tabList的不知道有哪些的把这里的注释解开跑一遍就行了
//await try_tabList();
// return;
$.isForbidden = false
$.wrong = false
size = 1
while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) {
if ($.nowTabIdIndex === args_xh.tabId.length) {

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let cookiesArr = [], cookie = '';
var timestamp = Math.round(new Date().getTime()).toString();
$.shareCodes = [];
$.fengxian = true;
let jdLogUrl = process.env.JD_LOG_URL ?? "http://106.126.11.114:5889/log"
!(async () => {
await requireConfig()
@ -44,7 +45,7 @@ let jdLogUrl = process.env.JD_LOG_URL ?? "http://106.126.11.114:5889/log"
$.isLogin = true;
$.nickName = '';
message = '';
await TotalBean();
//await TotalBean();
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
@ -61,14 +62,15 @@ let jdLogUrl = process.env.JD_LOG_URL ?? "http://106.126.11.114:5889/log"
async function main() {
await getInteractionHomeInfo();
await $.wait(500)
await $.wait(1000)
await queryInteractiveInfo($.projectId)
$.fengxian = true;
if ($.taskList) {
for (const vo of $.taskList) {
if (vo.ext.extraType !== 'brandMemberList' && vo.ext.extraType !== 'assistTaskDetail') {
if (vo.completionCnt < vo.assignmentTimesLimit) {
console.log(`任务:${vo.assignmentName},去完成`);
if (vo.ext) {
console.log(`任务:${vo.assignmentName},去完成`);
if (vo.ext) {
if (vo.ext.extraType === 'sign1') {
await doInteractiveAssignment($.projectId, vo.encryptAssignmentId, vo.ext.sign1.itemId)
}
@ -98,7 +100,10 @@ async function main() {
await doInteractiveAssignment($.projectId, vo.encryptAssignmentId, vi.itemId, 0)
}
}
}
}
if(!$.fengxian) {
return;
}
} else {
console.log(`任务:${vo.assignmentName},已完成`);
}
@ -123,7 +128,11 @@ async function doInteractiveAssignment(projectId, encryptAssignmentId, itemId, a
} else {
if (data) {
data = JSON.parse(data);
$.msgs = data.msg
console.log(data.msg);
if($.msgs.includes('风险等级未通过')) {
$.fengxian = false;
}
} else {
console.log("没有返回数据")
}