1
0
mirror of https://github.com/okyyds/yyds.git synced 2026-07-12 13:51:16 +08:00
This commit is contained in:
ooo
2022-12-13 12:31:13 +08:00
parent 5b2bfb3bca
commit b283a3ac0e
8 changed files with 0 additions and 4267 deletions

View File

@@ -1,408 +0,0 @@
#!/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":454,"channel":4,"itemId":"https%3A%2F%2Fsignfree.jd.com%2F%3FactivityId%3DPiuLvM8vamONsWzC0wqBGQ","checkVersion":False}
res=taskGetUrl('apDoTask', body, cookie)
if not res:
return
try:
if res['success']:
print('玩好了')
else:
print(f"{res['errMsg']}")
except:
print(f"错误\n{res}")
# 挖宝
def happyDigDo(cookie,roundid,rowIdx,colIdx):
body={"round":roundid,"rowIdx":rowIdx,"colIdx":colIdx,"linkId":linkId}
res=taskGetUrl("happyDigDo", body, cookie)
if not res:
return
if res['code']==0:
if res['success']:
typeid=res['data']['chunk']['type']
if typeid==2:
print(f"获得极速版红包 {res['data']['chunk']['value']} 🧧\n")
elif typeid==3:
print(f"🎉 获得微信零钱 {res['data']['chunk']['value']} 💰\n")
elif typeid==4:
print(f"💥Boom💥 挖到了炸弹 💣\n")
elif typeid==1:
print(f"获得优惠券 🎟️\n")
else:
print(f'不知道挖到了什么 🎁\n')
else:
print(f'{res}\n挖宝失败\n')
else:
print(f'{res}\n挖宝失败\n')
# # 助力码
# def inviteCode(cookie):
# global inviteCode_1_list,inviteCode_2_list
# body={"linkId":linkId}
# res=taskGetUrl("happyDigHome", body, cookie)
# if not res:
# return
# try:
# if res['success']:
# print(f"账号{get_pin(cookie)}助力码为{res['data']['inviteCode']}")
# inviteCode_1_list.append(res['data']['inviteCode'])
# print(f"账号{get_pin(cookie)}助力码为{res['data']['markedPin']}")
# inviteCode_2_list.append(res['data']['markedPin'])
# else:
# print('快去买买买吧')
# except:
# print(f"错误\n{res}\n")
# # 助力
# def happyDigHelp(cookie,fcwbinviter,fcwbinviteCode):
# print(f"账号 {get_pin(cookie)} 去助力{fcwbinviteCode}")
# xueliang(cookie)
# body={"linkId":linkId,"inviter":fcwbinviter,"inviteCode":fcwbinviteCode}
# res=taskGetUrl("happyDigHelp", body, cookie)
# if res['success']:
# print('助力成功')
# else:
# print(res['errMsg'])
# 领取奖励
def happyDigExchange(cookie):
for n in range(1,4):
xueliang(cookie)
print(f"\n开始领取第{n}场的奖励")
body={"round":n,"linkId":linkId}
res=taskGetUrl("happyDigExchange", body, cookie)
if not res:
return
if res['code']==0:
if res['success']:
try:
print(f"已领取极速版红包 {res['data']['redValue']} 🧧")
except:
print('')
if res['data']['wxValue'] != "0":
try:
print(f"可提现微信零钱 {res['data']['wxValue']} 💰")
except:
pass
else:
print(res['errMsg'])
else:
print(res['errMsg'])
# 微信现金id
def spring_reward_list(cookie):
happyDigExchange(cookie)
xueliang(cookie)
body={"linkId":linkId,"pageNum":1,"pageSize":6}
res=taskGetUrl("spring_reward_list", body, cookie)
if res['code']==0:
if res['success']:
items=res['data']['items']
for _items in items:
amount=_items['amount'] # 金额
prizeDesc=_items['prizeDesc'] # 金额备注
amountid=_items['id'] # 金额id
poolBaseId=_items['poolBaseId']
prizeGroupId=_items['prizeGroupId']
prizeBaseId=_items['prizeBaseId']
if '红包' in f"{prizeDesc}":
continue
if '' in f"{prizeDesc}":
continue
else:
print('\n去提现微信零钱 💰')
time.sleep(3.2)
wecat(cookie,amountid,poolBaseId,prizeGroupId,prizeBaseId)
else:
print(f'获取数据失败\n{res}\n')
else:
print(f'获取数据失败\n{res}\n')
# 微信提现
def wecat(cookie,amountid,poolBaseId,prizeGroupId,prizeBaseId):
xueliang(cookie)
url='https://api.m.jd.com'
headers={
'Cookie': cookie,
'Host': 'api.m.jd.com',
'Connection': 'keep-alive',
'origin': 'https://bnzf.jd.com',
'Content-Type': 'application/x-www-form-urlencoded',
"User-Agent": ua(),
'Accept-Language': 'zh-cn',
'Accept-Encoding': 'gzip, deflate, br',
}
body={"businessSource":"happyDiggerH5Cash","base":{"id":amountid,"business":"happyDigger","poolBaseId":poolBaseId,"prizeGroupId":prizeGroupId,"prizeBaseId":prizeBaseId,"prizeType":4},"linkId":linkId}
data=f"functionId=apCashWithDraw&body={json.dumps(body)}&t=1635596380119&appid=activities_platform&client=H5&clientVersion=1.0.0"
for n in range(3):
try:
res=requests.post(url,headers=headers,data=data,timeout=10).json()
break
except:
if n==2:
print('API请求失败请检查网路重试❗\n')
try:
if res['code']==0:
if res['success']:
print(res['data']['message']+'\n')
except:
print(res)
print('')
def main():
print('🔔发财挖宝,开始!\n')
# print('获取助力码\n')
# global inviteCode_1_list,inviteCode_2_list
# inviteCode_1_list=list()
# inviteCode_2_list=list()
# for cookie in cookie_list:
# inviteCode(cookie)
# print('互助\n')
# inviteCode_2_list=inviteCode_2_list[:2]
# for e,fcwbinviter in enumerate(inviteCode_2_list):
# fcwbinviteCode=inviteCode_1_list[e]
# for cookie in cookie_list:
# happyDigHelp(cookie,fcwbinviter,fcwbinviteCode)
print(f'====================共{len(cookie_list)}京东个账号Cookie=========\n')
for e,cookie in enumerate(cookie_list,start=1):
print(f'******开始【账号 {e}{get_pin(cookie)} *********\n')
apDoTask(cookie)
happyDigHome(cookie)
spring_reward_list(cookie)
if __name__ == '__main__':
main()

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,134 +0,0 @@
/**
* 京东-新品-魔方
* rabbit log
* cron: 10 9,12,15 * * *
*/
import {requireConfig, wait, post, get} from './TS_USER_AGENTS'
import {existsSync} from "fs";
import * as dotenv from 'dotenv'
let cookie: string = '', res: any = '', UserName: string, index: number, log: string = ''
let rabbitToken: string = process.env.RABBIT_TOKEN || '', tg_id: string = process.env.TG_ID || '', mf_logs: any
!(async () => {
dotenv.config()
if (existsSync('./test/mf_log.ts')) {
mf_logs = require('./test/mf_log').mf_logs
} else {
console.log('./test/mf_log not found')
}
let cookiesArr: any = await requireConfig()
for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i]
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
index = i + 1
console.log(`\n开始【京东账号${index}${UserName}\n`)
res = await api("functionId=getInteractionHomeInfo&body=%7B%22sign%22%3A%22u6vtLQ7ztxgykLEr%22%7D&appid=content_ecology&client=wh5&clientVersion=1.0.0")
let sign: string = res.result.taskConfig.projectId
res = await api(`functionId=queryInteractiveInfo&body=%7B%22encryptProjectId%22%3A%22${sign}%22%2C%22sourceCode%22%3A%22acexinpin0823%22%2C%22ext%22%3A%7B%7D%7D&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
for (let t of res.assignmentList) {
if (t.completionCnt < t.assignmentTimesLimit) {
if (t.ext) {
if (t.assignmentName === '每日签到') {
if (t.ext.sign1.status === 1) {
let signDay: number = t.ext.sign1.signList?.length || 0,
type: number = t.rewards[signDay].rewardType
console.log(signDay, type)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({
"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": "1", "actionType": "", "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}
})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log('签到成功')
} else {
console.log('已签到')
}
}
for (let proInfo of t.ext.productsInfo ?? []) {
if (proInfo.status === 1) {
console.log(t.assignmentName)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
if (res.msg === '任务已完成') {
break
}
}
}
for (let proInfo of t.ext.shoppingActivity ?? []) {
if (proInfo.status === 1) {
console.log(t.assignmentName)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 1, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
await wait(t.ext.waitDuration * 1000)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
}
}
for (let proInfo of t.ext.browseShop ?? []) {
if (proInfo.status === 1) {
console.log(t.assignmentName)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({
"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 1, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}
})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
await wait(t.ext.waitDuration * 1000)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({
"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": 0, "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFhPageh5"}
})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
}
}
for (let proInfo of t.ext.addCart ?? []) {
if (proInfo.status === 1) {
console.log(t.assignmentName)
log = await getLog()
res = await api(`functionId=doInteractiveAssignment&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": sign, "encryptAssignmentId": t.encryptAssignmentId, "sourceCode": "acexinpin0823", "itemId": proInfo.itemId, "actionType": "0", "completionFlag": "", "ext": {}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFJGh5"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
console.log(res.msg)
if (res.msg === '任务已完成') {
break
}
}
}
} else if (t.assignmentName === '去新品频道逛逛') {
}
}
}
}
})()
async function api(params: string) {
await wait(1000)
return await post("https://api.m.jd.com/client.action", params, {
'Content-Type': 'application/x-www-form-urlencoded',
"User-Agent": "Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; Mi Note 2 Build/OPR1.170623.032) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.1.1",
'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/2bf3XEEyWG11pQzPGkKpKX2GxJz2/index.html',
'Origin': 'https://h5.m.jd.com',
'Host': 'api.m.jd.com',
'Cookie': cookie
})
}
async function getLog() {
if (rabbitToken && tg_id) {
console.log('rabbit log api')
let {data} = await get(`http://www.madrabbit.cf:8080/license/log?tg_id=${tg_id}&token=${rabbitToken}`)
return `'"random":"${data.random}","log":"${data.log}"'`
} else if (mf_logs) {
return mf_logs[Math.floor(Math.random() * mf_logs.length)]
} else {
console.log('No log')
process.exit(0)
}
}

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,556 +0,0 @@
/*
分享到QQ查看邀请码 packetId就是
#自定义变量
export tytpacketId=""
[task_local]
#推一推助力码
0 0 * * * jd_tyt.js, tag=推一推, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
注意:助力码每天会变,旧的不可用。
助力逻辑:优先助力互助码变量
入口-极速版-推推赚大钱 5元无门槛卷 大概需要50人助力
*/
const $ = new Env('推推赚大钱-快速');
const notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const ua = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random()*4+10)}.${Math.ceil(Math.random()*4)};${randomString(40)}`
var status = 0
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '',
message;
let tytpacketId = '';
if (process.env.tytpacketId) {
tytpacketId = process.env.tytpacketId;
}
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
// if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
const JD_API_HOST = 'https://api.m.jd.com/client.action';
!(async() => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
return;
}
console.log("推一推开始")
for (let i = cookiesArr.length - 1; i > 0; i--) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
message = '';
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"
});
if ($.isNode()) {
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
}
continue
}
if (status == 1) {
break
}
await tythelp()
await $.wait(15000)
}
}
console.log("推一推结束")
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.done();
})
function tythelp() {
return new Promise(async(resolve) => {
let options = {
url: `https://api.m.jd.com/?t=1623066557140`,
body: `functionId=helpCoinDozer&appid=station-soa-h5&client=H5&clientVersion=1.0.0&t=1623120183787&body={"actId":"3075b6eab065464dad1c4042d345ac97","channel":"coin_dozer","antiToken":"","referer":"-1","frontendInitStatus":"s","packetId":"${tytpacketId}","helperStatus":"0"}&_ste=1&_stk=appid,body,client,clientVersion,functionId,t&h5st=20210608104303790;8489907903583162;10005;tk01w89681aa9a8nZDdIanIyWnVuWFLK4gnqY+05WKcPY3NWU2dcfa73B7PBM7ufJEN0U+4MyHW5N2mT/RNMq72ycJxH;7e6b956f1a8a71b269a0038bbb4abd24bcfb834a88910818cf1bdfc55b7b96e5`,
headers: {
"Origin": "https://pushgold.jd.com",
"Host": "api.m.jd.com",
"Accept": "application/json, text/plain, */*",
"User-Agent": ua,
"Cookie": cookie,
}
}
$.post(options, async(err, resp, data) => {
try {
data = JSON.parse(data);
if (data.code == 0) {
console.log("帮砍:" + data.data.amount)
} else if (data.msg.indexOf("完成") != -1) {
console.log("已完成砍价")
status = 1
} else {
if (data.msg !== "need verify"){
console.log(data.msg)
}
console.log(data.msg)
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
function randomString(e) {
e = e || 32;
let t = "abcdefhijkmnprstwxyz2345678",
a = t.length,
n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
async function taskPostUrl(functionId, body) {
return {
url: `${JD_API_HOST}`,
body: `functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&appid=content_ecology&uuid=6898c30638c55142969304c8e2167997fa59eb54&t=1622588448365`,
headers: {
'Cookie': cookie,
'Host': 'api.m.jd.com',
'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded',
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
'Accept-Language': 'zh-cn',
'Accept-Encoding': 'gzip, deflate, br',
}
}
}
async function TotalBean() {
return new Promise(async resolve => {
const options = {
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
"headers": {
"Accept": "application/json,text/plain, */*",
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-cn",
"Connection": "keep-alive",
"Cookie": cookie,
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
}
}
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (data) {
data = JSON.parse(data);
if (data["retcode"] === 13) {
$.isLogin = false; //cookie过期
return;
}
if (data["retcode"] === 0) {
$.nickName = (data["base"] && data["base"].nickname) || $.UserName;
} else {
$.nickName = $.UserName;
}
} else {
console.log(`京东服务器返回空数据`)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
async function safeGet(data) {
try {
if (typeof JSON.parse(data) == "object") {
return true;
}
} catch (e) {
console.log(e);
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
return false;
}
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
// prettier-ignore
function Env(t, e) {
"undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0);
class s {
constructor(t) {
this.env = t
}
send(t, e = "GET") {
t = "string" == typeof t ? {
url: t
} : t;
let s = this.get;
return "POST" === e && (s = this.post), new Promise((e, i) => {
s.call(this, t, (t, s, r) => {
t ? i(t) : e(s)
})
})
}
get(t) {
return this.send.call(this.env, t)
}
post(t) {
return this.send.call(this.env, t, "POST")
}
}
return new class {
constructor(t, e) {
this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`)
}
isNode() {
return "undefined" != typeof module && !!module.exports
}
isQuanX() {
return "undefined" != typeof $task
}
isSurge() {
return "undefined" != typeof $httpClient && "undefined" == typeof $loon
}
isLoon() {
return "undefined" != typeof $loon
}
toObj(t, e = null) {
try {
return JSON.parse(t)
} catch {
return e
}
}
toStr(t, e = null) {
try {
return JSON.stringify(t)
} catch {
return e
}
}
getjson(t, e) {
let s = e;
const i = this.getdata(t);
if (i) try {
s = JSON.parse(this.getdata(t))
} catch {}
return s
}
setjson(t, e) {
try {
return this.setdata(JSON.stringify(t), e)
} catch {
return !1
}
}
getScript(t) {
return new Promise(e => {
this.get({
url: t
}, (t, s, i) => e(i))
})
}
runScript(t, e) {
return new Promise(s => {
let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
i = i ? i.replace(/\n/g, "").trim() : i;
let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
const [o, h] = i.split("@"), n = {
url: `http://${h}/v1/scripting/evaluate`,
body: {
script_text: t,
mock_type: "cron",
timeout: r
},
headers: {
"X-Key": o,
Accept: "*/*"
}
};
this.post(n, (t, e, i) => s(i))
}).catch(t => this.logErr(t))
}
loaddata() {
if (!this.isNode()) return {}; {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile),
e = this.path.resolve(process.cwd(), this.dataFile),
s = this.fs.existsSync(t),
i = !s && this.fs.existsSync(e);
if (!s && !i) return {}; {
const i = s ? t : e;
try {
return JSON.parse(this.fs.readFileSync(i))
} catch (t) {
return {}
}
}
}
}
writedata() {
if (this.isNode()) {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile),
e = this.path.resolve(process.cwd(), this.dataFile),
s = this.fs.existsSync(t),
i = !s && this.fs.existsSync(e),
r = JSON.stringify(this.data);
s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
}
}
lodash_get(t, e, s) {
const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
let r = t;
for (const t of i)
if (r = Object(r)[t], void 0 === r) return s;
return r
}
lodash_set(t, e, s) {
return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
}
getdata(t) {
let e = this.getval(t);
if (/^@/.test(t)) {
const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
if (r) try {
const t = JSON.parse(r);
e = t ? this.lodash_get(t, i, "") : e
} catch (t) {
e = ""
}
}
return e
}
setdata(t, e) {
let s = !1;
if (/^@/.test(e)) {
const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}";
try {
const e = JSON.parse(h);
this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
} catch (e) {
const o = {};
this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
}
} else s = this.setval(t, e);
return s
}
getval(t) {
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setval(t, e) {
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
}
initGotEnv(t) {
this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
}
get(t, e = (() => {})) {
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
"X-Surge-Skip-Scripting": !1
})), $httpClient.get(t, (t, s, i) => {
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
})) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
hints: !1
})), $task.fetch(t).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
try {
if (t.headers["set-cookie"]) {
const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
}
} catch (t) {
this.logErr(t)
}
}).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => {
const {
message: s,
response: i
} = t;
e(s, i, i && i.body)
}))
}
post(t, e = (() => {})) {
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
"X-Surge-Skip-Scripting": !1
})), $httpClient.post(t, (t, s, i) => {
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
});
else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
hints: !1
})), $task.fetch(t).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => e(t));
else if (this.isNode()) {
this.initGotEnv(t);
const {
url: s,
...i
} = t;
this.got.post(s, i).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => {
const {
message: s,
response: i
} = t;
e(s, i, i && i.body)
})
}
}
time(t, e = null) {
const s = e ? new Date(e) : new Date;
let i = {
"M+": s.getMonth() + 1,
"d+": s.getDate(),
"H+": s.getHours(),
"m+": s.getMinutes(),
"s+": s.getSeconds(),
"q+": Math.floor((s.getMonth() + 3) / 3),
S: s.getMilliseconds()
};
/(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
return t
}
msg(e = t, s = "", i = "", r) {
const o = t => {
if (!t) return t;
if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {
"open-url": t
} : this.isSurge() ? {
url: t
} : void 0;
if ("object" == typeof t) {
if (this.isLoon()) {
let e = t.openUrl || t.url || t["open-url"],
s = t.mediaUrl || t["media-url"];
return {
openUrl: e,
mediaUrl: s
}
}
if (this.isQuanX()) {
let e = t["open-url"] || t.url || t.openUrl,
s = t["media-url"] || t.mediaUrl;
return {
"open-url": e,
"media-url": s
}
}
if (this.isSurge()) {
let e = t.url || t.openUrl || t["open-url"];
return {
url: e
}
}
}
};
if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
// let t = ["", "==============📣系统通知📣=============="];
// t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
}
}
log(...t) {
// t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
}
logErr(t, e) {
const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t)
}
wait(t) {
return new Promise(e => setTimeout(e, t))
}
done(t = {}) {
const e = (new Date).getTime(),
s = (e - this.startTime) / 1e3;
this.log("", `🔔${this.name}, 结束! 🕛 ${s}`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, e)
}

View File

@@ -1,49 +0,0 @@
let common = require("./function/common");
let $ = new common.env('京喜购物返红包助力');
let min = 5,
help = $.config[$.filename(__filename)] || Math.min(min, $.config.JdMain) || min;
$.setOptions({
headers: {
'content-type': 'application/json',
'user-agent': 'jdapp;iPhone;9.4.6;14.2;965af808880443e4c1306a54afdd5d5ae771de46;network/wifi;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone8,4;addressid/;supportBestPay/0;appBuild/167618;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'referer': 'https://happy.m.jd.com/babelDiy/Zeus/3ugedFa7yA6NhxLN5gw2L3PF9sQC/index.html?asid=287215626&un_area=12_904_905_57901&lng=117.612969135975&lat=23.94014745198865',
}
});
$.readme = `
在京喜下单,如订单有购物返现,脚本会自动查询返现groupid并予以助力,目前每个账号每天能助力3次
44 */6 * * * task ${$.runfile}
export ${$.runfile}=2 #如需增加被助力账号,在这边修改人数
`
eval(common.eval.mainEval($));
async function prepare() {
let url = `https://wq.jd.com/bases/orderlist/list?order_type=3&start_page=1&last_page=0&page_size=10&callersource=newbiz&t=${$.timestamp}&traceid=&g_ty=ls&g_tk=606717070`
for (let j of cookies['help']) {
$.setCookie(j);
await $.curl(url)
try {
for (let k of $.source.orderList) {
try {
let orderid = k.parentId != '0' ? k.parentId : k.orderId
let url = `https://wq.jd.com/fanxianzl/zhuli/QueryGroupDetail?isquerydraw=1&orderid=${orderid}&groupid=&sceneval=2&g_login_type=1&g_ty=ls`
let dec = await jxAlgo.dec(url)
await $.curl(dec.url)
let now = parseInt(new Date() / 1000)
let end = $.source.data.groupinfo.end_time
if (end > now && $.source.data.groupinfo.openhongbaosum != $.source.data.groupinfo.totalhongbaosum) {
let groupid = $.source.data.groupinfo.groupid;
$.sharecode.push({
'groupid': groupid
})
}
} catch (e) {}
}
} catch (e) {}
}
}
async function main(id) {
common.assert(id.groupid, '没有可助力ID')
let url = `http://wq.jd.com/fanxianzl/zhuli/Help?groupid=${id.groupid}&_stk=groupid&_ste=2&g_ty=ls&g_tk=1710198667&sceneval=2&g_login_type=1`
let dec = await jxAlgo.dec(url)
await $.curl(dec.url)
console.log($.source.data.prize.discount)
}