mirror of
https://github.com/shufflewzc/faker2.git
synced 2025-04-23 02:48:44 +08:00
expired
This commit is contained in:
parent
d23ca87f1d
commit
ceb7983ffd
1394
gua_wealth_island.js
1394
gua_wealth_island.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
@ -1,72 +0,0 @@
|
|||||||
let common = require("./function/common");
|
|
||||||
let $ = new common.env('京喜工厂助力');
|
|
||||||
let min = 3,
|
|
||||||
help = $.config[$.filename(__filename)] || Math.min(min, $.config.JdMain) || min;
|
|
||||||
$.setOptions({
|
|
||||||
headers: {
|
|
||||||
'content-type': 'application/json',
|
|
||||||
'user-agent': 'jdpingou;iPhone;4.8.2;13.7;a3b4e844090b28d5c38e7529af8115172079be4d;network/wifi;model/iPhone8,1;appBuild/100546;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/374;pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
|
||||||
'referer': 'https://st.jingxi.com/pingou/dream_factory/divide.html?activeId=laD7IwPwDF1-Te-MvbW9Iw==&_close=1&jxsid=16232028831911667857',
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$.readme = `
|
|
||||||
44 */6 * * * task ${$.runfile}
|
|
||||||
export ${$.runfile}=2 #如需增加被助力账号,在这边修改人数
|
|
||||||
`
|
|
||||||
eval(common.eval.mainEval($));
|
|
||||||
async function prepare() {
|
|
||||||
let deramUrl = 'https://st.jingxi.com/pingou/dream_factory/index.html?ptag=7155.9.46'
|
|
||||||
let html = await $.curl(deramUrl)
|
|
||||||
try {
|
|
||||||
ary = $.matchall(/activeId=([^\&\,]+)","bgImg".+?"start":"([^\"]+)"/g, html)
|
|
||||||
dicts = {}
|
|
||||||
for (let i of ary) {
|
|
||||||
dicts[new Date(i[1]).getTime()] = i[0]
|
|
||||||
}
|
|
||||||
max = Math.max(...Object.keys(dicts).filter(d => parseInt(d) < $.timestamp))
|
|
||||||
$.activeId = dicts[max]
|
|
||||||
} catch (e) {
|
|
||||||
$.activeId = 'yNtpovqFehHByNrt_lmb3g=='
|
|
||||||
}
|
|
||||||
console.log("开团ID:", $.activeId)
|
|
||||||
let url = `https://m.jingxi.com/dreamfactory/tuan/QueryActiveConfig?activeId=${$.activeId}&tuanId=&_time=1623214804148&_stk=_time%2CactiveId%2CtuanId&_ste=1&sceneval=2&g_login_type=1&callback=jsonpCBKA&g_ty=ls`
|
|
||||||
let dec = await jxAlgo.dec(url)
|
|
||||||
for (let j of cookies['help']) {
|
|
||||||
$.setCookie(j);
|
|
||||||
await $.curl(dec.url)
|
|
||||||
try {
|
|
||||||
if ($.source.data.userTuanInfo.tuanId) {
|
|
||||||
$.sharecode.push($.compact($.source.data.userTuanInfo, ['activeId', 'tuanId']))
|
|
||||||
} else {}
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function main(id) {
|
|
||||||
common.assert(id.activeId, '没有开团ID')
|
|
||||||
let url = `https://m.jingxi.com/dreamfactory/tuan/JoinTuan?activeId=${id.activeId}&tuanId=${id.tuanId}&_time=1623214617107&_stk=_time%2CactiveId%2CtuanId&_ste=1&sceneval=2&g_login_type=1&g_ty=ls`
|
|
||||||
let dec = await jxAlgo.dec(url)
|
|
||||||
let params = {
|
|
||||||
'url': dec.url,
|
|
||||||
'cookie': id.cookie
|
|
||||||
}
|
|
||||||
await $.curl(params)
|
|
||||||
console.log($.source)
|
|
||||||
}
|
|
||||||
async function extra() {
|
|
||||||
for (let j of cookies['help']) {
|
|
||||||
$.setCookie(j);
|
|
||||||
let url = `https://m.jingxi.com/dreamfactory/tuan/QueryActiveConfig?activeId=${$.activeId}&tuanId=&_time=1623214804148&_stk=_time%2CactiveId%2CtuanId&_ste=1&sceneval=2&g_login_type=1&callback=jsonpCBKA&g_ty=ls`
|
|
||||||
let dec = await jxAlgo.dec(url)
|
|
||||||
await $.curl(dec.url)
|
|
||||||
url = `https://m.jingxi.com/dreamfactory/tuan/Award?activeId=${$.source.data.userTuanInfo.activeId}&tuanId=${$.source.data.userTuanInfo.tuanId}&_time=1623518911051&_stk=_time%2CactiveId%2CtuanId&_ste=1&_=1623518911082&sceneval=2&g_login_type=1&callback=jsonpCBKF&g_ty=ls`
|
|
||||||
dec = await jxAlgo.dec(url)
|
|
||||||
await $.curl(dec.url)
|
|
||||||
console.log($.source)
|
|
||||||
if ($.source.msg != '您还没有成团') {
|
|
||||||
url = `https://m.jingxi.com/dreamfactory/tuan/CreateTuan?activeId=${$.activeId}&isOpenApp=1&_time=1624120758151&_stk=_time%2CactiveId%2CisOpenApp&_ste=1`
|
|
||||||
dec = await jxAlgo.dec(url)
|
|
||||||
await $.curl(dec.url)
|
|
||||||
console.log($.source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
139
jd_babel_sign.js
139
jd_babel_sign.js
File diff suppressed because one or more lines are too long
139
jd_bean_box.ts
139
jd_bean_box.ts
@ -1,139 +0,0 @@
|
|||||||
/**
|
|
||||||
* 领京豆-任务
|
|
||||||
* 助力:内部 -> HW
|
|
||||||
* cron: 1 0,9,12,18 * * *
|
|
||||||
*/
|
|
||||||
|
|
||||||
import axios from 'axios'
|
|
||||||
import USER_AGENT, {get, randomNumString, requireConfig, wait} from './TS_USER_AGENTS'
|
|
||||||
|
|
||||||
let cookie: string = '', res: any = '', UserName: string, index: number, uuid: string
|
|
||||||
// let shareCodeSelf: { shareCode: string, groupCode: string, activeId: string }[] = [], shareCode: { shareCode: string, groupCode: string, activeId: string }[] = [], shareCodeHW: { shareCode: string, groupCode: string, activeId: string }[] = []
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
let cookiesArr: string[] = 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`)
|
|
||||||
|
|
||||||
let headers: object = {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Origin': 'https://h5.m.jd.com',
|
|
||||||
'User-Agent': USER_AGENT,
|
|
||||||
'Referer': 'https://h5.m.jd.com/',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
res = await get('https://api.m.jd.com/client.action?functionId=initForTurntableFarm&body=%7B%22version%22%3A4%2C%22channel%22%3A1%7D&appid=wh5', headers)
|
|
||||||
let times: number = res.remainLotteryTimes
|
|
||||||
console.log('剩余抽奖机会:', times)
|
|
||||||
for (let j = 0; j < times; j++) {
|
|
||||||
console.log('开始抽奖...')
|
|
||||||
res = await get('https://api.m.jd.com/client.action?functionId=lotteryForTurntableFarm&body=%7B%22type%22%3A1%2C%22version%22%3A4%2C%22channel%22%3A1%7D&appid=wh5', headers)
|
|
||||||
if (res.code === '0') {
|
|
||||||
if (res.type === 'thanks') {
|
|
||||||
console.log('抽奖成功,获得:狗屁')
|
|
||||||
} else {
|
|
||||||
console.log('抽奖成功,获得:', res.type)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('抽奖失败', res)
|
|
||||||
}
|
|
||||||
await wait(5000)
|
|
||||||
}
|
|
||||||
|
|
||||||
uuid = randomNumString(40)
|
|
||||||
for (let j = 0; j < 2; j++) {
|
|
||||||
console.log(`Round:${j + 1}`)
|
|
||||||
res = await api('beanTaskList', {"viewChannel": "AppHome"})
|
|
||||||
try {
|
|
||||||
for (let t of res.data.taskInfos) {
|
|
||||||
if (t.status === 1) {
|
|
||||||
console.log(t.taskName)
|
|
||||||
res = await api('beanDoTask', {
|
|
||||||
"actionType": t.taskType === 3 ? 0 : 1,
|
|
||||||
"taskToken": t.subTaskVOS[0].taskToken
|
|
||||||
})
|
|
||||||
res.data?.bizMsg ? console.log(res.data.bizMsg) : console.log(res)
|
|
||||||
await wait(t.waitDuration * 1000 || 2000)
|
|
||||||
|
|
||||||
if (t.taskType !== 3) {
|
|
||||||
res = await api('beanDoTask', {
|
|
||||||
"actionType": 0,
|
|
||||||
"taskToken": t.subTaskVOS[0].taskToken
|
|
||||||
})
|
|
||||||
if (res.data?.bizMsg)
|
|
||||||
console.log(res.data.bizMsg)
|
|
||||||
}
|
|
||||||
await wait(1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Error!', e)
|
|
||||||
}
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 抢京豆
|
|
||||||
/*
|
|
||||||
res = await qjd('signBeanGroupStageIndex', {"monitor_refer": "", "rnVersion": "3.9", "fp": "-1", "shshshfp": "-1", "shshshfpa": "-1", "referUrl": "-1", "userAgent": "-1", "jda": "-1", "monitor_source": "bean_m_bean_index"})
|
|
||||||
if (!res.data.shareCode) {
|
|
||||||
console.log('抢京豆 init...')
|
|
||||||
res = await qjd('signGroupHit', {"activeType": 2})
|
|
||||||
await wait(1000)
|
|
||||||
res = await qjd('signBeanGroupStageIndex', {"monitor_refer": "", "rnVersion": "3.9", "fp": "-1", "shshshfp": "-1", "shshshfpa": "-1", "referUrl": "-1", "userAgent": "-1", "jda": "-1", "monitor_source": "bean_m_bean_index"})
|
|
||||||
}
|
|
||||||
if (res.data.shareCode) {
|
|
||||||
console.log('助力码', res.data.shareCode)
|
|
||||||
shareCodeSelf.push({shareCode: res.data.shareCode, groupCode: res.data.groupCode, activeId: res.data.jklInfo.keyId})
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('内部助力', shareCodeSelf)
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
if (shareCodeHW.length === 0) {
|
|
||||||
await getShareCodeHW()
|
|
||||||
}
|
|
||||||
shareCode = [...shareCodeSelf, ...shareCodeHW]
|
|
||||||
uuid = randomString(40)
|
|
||||||
cookie = cookiesArr[i]
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
for (let code of shareCode) {
|
|
||||||
console.log(`${UserName} 去助力 ${code.shareCode}`)
|
|
||||||
res = await qjd('signGroupHelp', {"activeType": 2, "groupCode": code.groupCode, "shareCode": code.shareCode, "activeId": code.activeId, "source": "guest"})
|
|
||||||
console.log(res.data?.helpToast)
|
|
||||||
if (res.data.respCode === 'SG209')
|
|
||||||
break
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
async function api(fn: string, body: object) {
|
|
||||||
let {data}: any = await axios.post(`https://api.m.jd.com/client.action?functionId=${fn}`,
|
|
||||||
`body=${encodeURIComponent(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=10.0.8&uuid=${uuid}&openudid=${uuid}`, {
|
|
||||||
headers: {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'referer': '',
|
|
||||||
'user-agent': 'JD4iPhone/167863%20(iPhone;%20iOS;%20Scale/3.00)',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
/*async function qjd(fn: string, body?: object) {
|
|
||||||
let {data} = await axios.get(`https://api.m.jd.com/client.action?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=10.0.8&uuid=${uuid}&openudid=${uuid}`, {
|
|
||||||
headers: {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'User-Agent': USER_AGENT,
|
|
||||||
'Referer': 'https://h5.m.jd.com/rn/3MQXMdRUTeat9xqBSZDSCCAE9Eqz/index.html',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return data
|
|
||||||
}*/
|
|
526
jd_blueCoin.js
526
jd_blueCoin.js
File diff suppressed because one or more lines are too long
180
jd_btdraw.py
180
jd_btdraw.py
@ -1,180 +0,0 @@
|
|||||||
# -*- coding:utf-8 -*-
|
|
||||||
#pip install PyExecJS
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
cron: 23 10 * * *
|
|
||||||
new Env('京东金融天天试手气');
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import random
|
|
||||||
import string
|
|
||||||
import urllib
|
|
||||||
|
|
||||||
try:
|
|
||||||
import execjs
|
|
||||||
except:
|
|
||||||
print('缺少依赖文件PyExecJS,请先去Python3安装PyExecJS后再执行')
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
def printf(text):
|
|
||||||
print(text)
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
def load_send():
|
|
||||||
global send
|
|
||||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
sys.path.append(cur_path)
|
|
||||||
if os.path.exists(cur_path + "/sendNotify.py"):
|
|
||||||
try:
|
|
||||||
from sendNotify import send
|
|
||||||
except:
|
|
||||||
send=False
|
|
||||||
printf("加载通知服务失败~")
|
|
||||||
else:
|
|
||||||
send=False
|
|
||||||
printf("加载通知服务失败~")
|
|
||||||
load_send()
|
|
||||||
|
|
||||||
def get_remarkinfo():
|
|
||||||
url='http://127.0.0.1:5600/api/envs'
|
|
||||||
try:
|
|
||||||
with open('/ql/config/auth.json', 'r') as f:
|
|
||||||
token=json.loads(f.read())['token']
|
|
||||||
headers={
|
|
||||||
'Accept':'application/json',
|
|
||||||
'authorization':'Bearer '+token,
|
|
||||||
}
|
|
||||||
response=requests.get(url=url,headers=headers)
|
|
||||||
|
|
||||||
for i in range(len(json.loads(response.text)['data'])):
|
|
||||||
if json.loads(response.text)['data'][i]['name']=='JD_COOKIE':
|
|
||||||
try:
|
|
||||||
if json.loads(response.text)['data'][i]['remarks'].find('@@')==-1:
|
|
||||||
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].replace('remark=','')
|
|
||||||
else:
|
|
||||||
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].split("@@")[0].replace('remark=','').replace(';','')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
printf('读取auth.json文件出错,跳过获取备注')
|
|
||||||
|
|
||||||
def randomuserAgent():
|
|
||||||
global uuid,addressid,iosVer,iosV,clientVersion,iPhone,area,ADID,lng,lat
|
|
||||||
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
|
|
||||||
addressid = ''.join(random.sample('1234567898647', 10))
|
|
||||||
iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
|
|
||||||
iosV = iosVer.replace('.', '_')
|
|
||||||
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
|
|
||||||
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
|
|
||||||
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
|
|
||||||
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
|
|
||||||
lng='119.31991256596'+str(random.randint(100,999))
|
|
||||||
lat='26.1187118976'+str(random.randint(100,999))
|
|
||||||
UserAgent=''
|
|
||||||
if not UserAgent:
|
|
||||||
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
|
|
||||||
else:
|
|
||||||
return UserAgent
|
|
||||||
|
|
||||||
def JDSignValidator(url):
|
|
||||||
with open('JDSignValidator.js', 'r', encoding='utf-8') as f:
|
|
||||||
jstext = f.read()
|
|
||||||
js = execjs.compile(jstext)
|
|
||||||
result = js.call('getBody', url)
|
|
||||||
fp=result['fp']
|
|
||||||
a=result['a']
|
|
||||||
d=result['d']
|
|
||||||
return fp,a,d
|
|
||||||
|
|
||||||
|
|
||||||
def geteid(a,d):
|
|
||||||
url=f'https://gia.jd.com/fcf.html?a={a}'
|
|
||||||
data=f'&d={d}'
|
|
||||||
headers={
|
|
||||||
'Host':'gia.jd.com',
|
|
||||||
'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8',
|
|
||||||
'Origin':'https://jrmkt.jd.com',
|
|
||||||
'Accept-Encoding':'gzip, deflate, br',
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Accept':'*/*',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Referer':'https://jrmkt.jd.com/',
|
|
||||||
'Content-Length':'376',
|
|
||||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9',
|
|
||||||
}
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
return response.text
|
|
||||||
|
|
||||||
def draw(activityid,eid,fp):
|
|
||||||
global sendNotifyflag
|
|
||||||
global prizeAward
|
|
||||||
sendNotifyflag=False
|
|
||||||
prizeAward=0
|
|
||||||
url='https://jrmkt.jd.com/activity/newPageTake/takePrize'
|
|
||||||
data=f'activityId={activityid}&eid={eid}&fp={fp}'
|
|
||||||
headers={
|
|
||||||
'Host':'jrmkt.jd.com',
|
|
||||||
'Accept':'application/json, text/javascript, */*; q=0.01',
|
|
||||||
'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; charset=UTF-8',
|
|
||||||
'Origin':'https://jrmkt.jd.com',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Referer':'https://jrmkt.jd.com/ptp/wl/vouchers.html?activityId=Q029794F612c2E2O1D2a0N161v0Z2i2s9nJ&jrcontainer=h5&jrlogin=true&jrcloseweb=false',
|
|
||||||
'Content-Length':str(len(data)),
|
|
||||||
'Cookie':ck
|
|
||||||
}
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
try:
|
|
||||||
if json.loads(response.text)['prizeModels'][0]['prizeAward'].find('元')!=-1:
|
|
||||||
printf('获得'+json.loads(response.text)['prizeModels'][0]['useLimit']+'的'+json.loads(response.text)['prizeModels'][0]['prizeName']+'\n金额:'+json.loads(response.text)['prizeModels'][0]['prizeAward']+'\n有效期:'+json.loads(response.text)['prizeModels'][0]['validTime']+'\n\n')
|
|
||||||
if int((json.loads(response.text)['prizeModels'][0]['prizeAward']).replace('.00元',''))>=5:
|
|
||||||
prizeAward=json.loads(response.text)['prizeModels'][0]['prizeAward']
|
|
||||||
sendNotifyflag=True
|
|
||||||
if json.loads(response.text)['prizeModels'][0]['prizeAward'].find('期')!=-1:
|
|
||||||
printf(response.text)
|
|
||||||
send('抽到白条分期券','去看日志')
|
|
||||||
except:
|
|
||||||
printf('出错啦,出错原因为:'+json.loads(response.text)['failDesc']+'\n\n')
|
|
||||||
|
|
||||||
time.sleep(5)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
printf('游戏入口:京东金融-白条-天天试手气\n')
|
|
||||||
remarkinfos={}
|
|
||||||
get_remarkinfo()
|
|
||||||
try:
|
|
||||||
cks = os.environ["JD_COOKIE"].split("&")
|
|
||||||
except:
|
|
||||||
f = open("/jd/config/config.sh", "r", encoding='utf-8')
|
|
||||||
cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
|
|
||||||
f.close()
|
|
||||||
for ck in cks:
|
|
||||||
ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
|
|
||||||
try:
|
|
||||||
if remarkinfos[ptpin]!='':
|
|
||||||
printf("--账号:" + remarkinfos[ptpin] + "--")
|
|
||||||
username=remarkinfos[ptpin]
|
|
||||||
else:
|
|
||||||
printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
|
|
||||||
username=urllib.parse.unquote(ptpin)
|
|
||||||
except:
|
|
||||||
printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
|
|
||||||
username=urllib.parse.unquote(ptpin)
|
|
||||||
UserAgent=randomuserAgent()
|
|
||||||
info=JDSignValidator('https://prodev.m.jd.com/mall/active/498THTs5KGNqK5nEaingGsKEi6Ao/index.html')
|
|
||||||
eid=json.loads(geteid(info[1],info[2]).split('_*')[1])['eid']
|
|
||||||
fp=info[0]
|
|
||||||
draw('Q72966994128142102X259KS',eid,fp)
|
|
||||||
if sendNotifyflag:
|
|
||||||
send('京东白条抽奖通知',username+'抽到'+str(prizeAward)+'的优惠券了,速去京东金融-白条-天天试手气查看')
|
|
266
jd_btfree.py
266
jd_btfree.py
@ -1,266 +0,0 @@
|
|||||||
# -*- coding:utf-8 -*-
|
|
||||||
#依赖管理-Python3-添加依赖PyExecJS
|
|
||||||
#想拿券的cookie环境变量JDJR_COOKIE,格式就是普通的cookie格式(pt_key=xxx;pt_pin=xxx)
|
|
||||||
#活动每天早上10点开始截止到这个月28号,建议corn 5 0 10 * * *
|
|
||||||
import execjs
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import random
|
|
||||||
import string
|
|
||||||
import urllib
|
|
||||||
from urllib.parse import quote
|
|
||||||
|
|
||||||
|
|
||||||
#以下部分参考Curtin的脚本:https://github.com/curtinlv/JD-Script
|
|
||||||
|
|
||||||
|
|
||||||
def randomuserAgent():
|
|
||||||
global uuid,addressid,iosVer,iosV,clientVersion,iPhone,ADID,area,lng,lat
|
|
||||||
|
|
||||||
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
|
|
||||||
addressid = ''.join(random.sample('1234567898647', 10))
|
|
||||||
iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
|
|
||||||
iosV = iosVer.replace('.', '_')
|
|
||||||
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
|
|
||||||
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
|
|
||||||
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
|
|
||||||
|
|
||||||
|
|
||||||
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
|
|
||||||
lng='119.31991256596'+str(random.randint(100,999))
|
|
||||||
lat='26.1187118976'+str(random.randint(100,999))
|
|
||||||
|
|
||||||
|
|
||||||
UserAgent=''
|
|
||||||
if not UserAgent:
|
|
||||||
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
|
|
||||||
else:
|
|
||||||
return UserAgent
|
|
||||||
|
|
||||||
#以上部分参考Curtin的脚本:https://github.com/curtinlv/JD-Script
|
|
||||||
|
|
||||||
|
|
||||||
def printf(text):
|
|
||||||
print(text+'\n')
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
|
|
||||||
def load_send():
|
|
||||||
global send
|
|
||||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
sys.path.append(cur_path)
|
|
||||||
if os.path.exists(cur_path + "/sendNotify.py"):
|
|
||||||
try:
|
|
||||||
from sendNotify import send
|
|
||||||
except:
|
|
||||||
send=False
|
|
||||||
printf("加载通知服务失败~")
|
|
||||||
else:
|
|
||||||
send=False
|
|
||||||
printf("加载通知服务失败~")
|
|
||||||
load_send()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_remarkinfo():
|
|
||||||
url='http://127.0.0.1:5600/api/envs'
|
|
||||||
try:
|
|
||||||
with open('/ql/config/auth.json', 'r') as f:
|
|
||||||
token=json.loads(f.read())['token']
|
|
||||||
headers={
|
|
||||||
'Accept':'application/json',
|
|
||||||
'authorization':'Bearer '+token,
|
|
||||||
}
|
|
||||||
response=requests.get(url=url,headers=headers)
|
|
||||||
|
|
||||||
for i in range(len(json.loads(response.text)['data'])):
|
|
||||||
if json.loads(response.text)['data'][i]['name']=='JD_COOKIE':
|
|
||||||
try:
|
|
||||||
if json.loads(response.text)['data'][i]['remarks'].find('@@')==-1:
|
|
||||||
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].replace('remark=','')
|
|
||||||
else:
|
|
||||||
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].split("@@")[0].replace('remark=','').replace(';','')
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
printf('读取auth.json文件出错,跳过获取备注')
|
|
||||||
|
|
||||||
|
|
||||||
def JDSignValidator(url):
|
|
||||||
with open('JDSignValidator.js', 'r', encoding='utf-8') as f:
|
|
||||||
jstext = f.read()
|
|
||||||
ctx = execjs.compile(jstext)
|
|
||||||
result = ctx.call('getBody', url)
|
|
||||||
fp=result['fp']
|
|
||||||
a=result['a']
|
|
||||||
d=result['d']
|
|
||||||
return fp,a,d
|
|
||||||
|
|
||||||
|
|
||||||
def geteid(a,d):
|
|
||||||
url=f'https://gia.jd.com/fcf.html?a={a}'
|
|
||||||
data=f'&d={d}'
|
|
||||||
headers={
|
|
||||||
'Host':'gia.jd.com',
|
|
||||||
'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8',
|
|
||||||
'Origin':'https://jrmkt.jd.com',
|
|
||||||
'Accept-Encoding':'gzip, deflate, br',
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Accept':'*/*',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Referer':'https://jrmkt.jd.com/',
|
|
||||||
'Content-Length':'376',
|
|
||||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9',
|
|
||||||
}
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
return response.text
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def gettoken():
|
|
||||||
url='https://gia.jd.com/m.html'
|
|
||||||
headers={'User-Agent':UserAgent}
|
|
||||||
response=requests.get(url=url,headers=headers)
|
|
||||||
return response.text.split(';')[0].replace('var jd_risk_token_id = \'','').replace('\'','')
|
|
||||||
|
|
||||||
|
|
||||||
def getsharetasklist(ck,eid,fp,token):
|
|
||||||
url='https://ms.jr.jd.com/gw/generic/bt/h5/m/getShareTaskList'
|
|
||||||
data='reqData='+quote('{"extMap":{"eid":"%s","fp":"%s","sdkToken":"","token":"%s","appType":"1","pageUrl":"https://btfront.jd.com/release/shareCouponRedemption/helpList/?channelId=17&channelName=pdy&jrcontainer=h5&jrlogin=true&jrcloseweb=false"},"channelId":"17","bizGroup":18}'%(eid,fp,token))
|
|
||||||
headers={
|
|
||||||
'Host':'ms.jr.jd.com',
|
|
||||||
'Content-Type':'application/x-www-form-urlencoded',
|
|
||||||
'Origin':'https://btfront.jd.com',
|
|
||||||
'Accept-Encoding':'gzip, deflate, br',
|
|
||||||
'Cookie':ck,
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Accept':'application/json, text/plain, */*',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Referer':'https://btfront.jd.com/',
|
|
||||||
'Content-Length':str(len(data)),
|
|
||||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9'
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
for i in range(len(json.loads(response.text)['resultData']['data'])):
|
|
||||||
if json.loads(response.text)['resultData']['data'][i]['couponBigWord']=='12' and json.loads(response.text)['resultData']['data'][i]['couponSmallWord']=='期':
|
|
||||||
printf('12期免息券活动id:'+str(json.loads(response.text)['resultData']['data'][i]['activityId']))
|
|
||||||
return json.loads(response.text)['resultData']['data'][i]['activityId']
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
printf('获取任务信息出错,程序即将退出!')
|
|
||||||
os._exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def obtainsharetask(ck,eid,fp,token,activityid):
|
|
||||||
url='https://ms.jr.jd.com/gw/generic/bt/h5/m/obtainShareTask'
|
|
||||||
data='reqData='+quote('{"extMap":{"eid":"%s","fp":"%s","sdkToken":"","token":"%s","appType":"1","pageUrl":"https://btfront.jd.com/release/shareCouponRedemption/helpList/?channelId=17&channelName=pdy&jrcontainer=h5&jrlogin=true&jrcloseweb=false"},"activityId":%s}'%(eid,fp,token,activityid))
|
|
||||||
headers={
|
|
||||||
'Host':'ms.jr.jd.com',
|
|
||||||
'Content-Type':'application/x-www-form-urlencoded',
|
|
||||||
'Origin':'https://btfront.jd.com',
|
|
||||||
'Accept-Encoding':'gzip, deflate, br',
|
|
||||||
'Cookie':ck,
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Accept':'application/json, text/plain, */*',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Referer':'https://btfront.jd.com/',
|
|
||||||
'Content-Length':str(len(data)),
|
|
||||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9'
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
printf('obtainActivityId:'+json.loads(response.text)['resultData']['data']['obtainActivityId'])
|
|
||||||
printf('inviteCode:'+json.loads(response.text)['resultData']['data']['inviteCode'])
|
|
||||||
return json.loads(response.text)['resultData']['data']['obtainActivityId']+'@'+json.loads(response.text)['resultData']['data']['inviteCode']
|
|
||||||
except:
|
|
||||||
printf('开启任务出错,程序即将退出!')
|
|
||||||
os._exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
def assist(ck,eid,fp,token,obtainActivityid,invitecode):
|
|
||||||
url='https://ms.jr.jd.com/gw/generic/bt/h5/m/helpFriend'
|
|
||||||
data='reqData='+quote('{"extMap":{"eid":"%s","fp":"%s","sdkToken":"","token":"%s","appType":"10","pageUrl":"https://btfront.jd.com/release/shareCouponRedemption/sharePage/?obtainActivityId=%s&channelId=17&channelName=pdy&jrcontainer=h5&jrcloseweb=false&jrlogin=true&inviteCode=%s"},"obtainActivityId":"%s","inviteCode":"%s"}'%(eid,fp,token,obtainActivityid,invitecode,obtainActivityid,invitecode))
|
|
||||||
headers={
|
|
||||||
'Host':'ms.jr.jd.com',
|
|
||||||
'Content-Type':'application/x-www-form-urlencoded',
|
|
||||||
'Origin':'https://btfront.jd.com',
|
|
||||||
'Accept-Encoding':'gzip, deflate, br',
|
|
||||||
'Cookie':ck,
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Accept':'application/json, text/plain, */*',
|
|
||||||
'User-Agent':UserAgent,
|
|
||||||
'Referer':'https://btfront.jd.com/',
|
|
||||||
'Content-Length':str(len(data)),
|
|
||||||
'Accept-Language':'zh-CN,zh-Hans;q=0.9'
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
response=requests.post(url=url,headers=headers,data=data)
|
|
||||||
if response.text.find('本次助力活动已完成')!=-1:
|
|
||||||
send('京东白条12期免息优惠券助力完成','去京东金融-白条-我的-我的优惠券看看吧')
|
|
||||||
printf('助力完成,程序即将退出!')
|
|
||||||
os._exit(0)
|
|
||||||
else:
|
|
||||||
if json.loads(response.text)['resultData']['result']['code']=='0000':
|
|
||||||
printf('助力成功')
|
|
||||||
elif json.loads(response.text)['resultData']['result']['code']=='M1003':
|
|
||||||
printf('该用户未开启白条,助力失败!')
|
|
||||||
elif json.loads(response.text)['resultData']['result']['code']=='U0002':
|
|
||||||
printf('该用户白条账户异常,助力失败!')
|
|
||||||
elif json.loads(response.text)['resultData']['result']['code']=='E0004':
|
|
||||||
printf('该活动仅限受邀用户参与,助力失败!')
|
|
||||||
else:
|
|
||||||
print(response.text)
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
print(response.text)
|
|
||||||
except:
|
|
||||||
printf('助力出错,可能是cookie过期了')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
remarkinfos={}
|
|
||||||
get_remarkinfo()
|
|
||||||
|
|
||||||
|
|
||||||
jdjrcookie=os.environ["JDJR_COOKIE"]
|
|
||||||
|
|
||||||
UserAgent=randomuserAgent()
|
|
||||||
info=JDSignValidator('https://jrmfp.jr.jd.com/')
|
|
||||||
eid=json.loads(geteid(info[1],info[2]).split('_*')[1])['eid']
|
|
||||||
fp=info[0]
|
|
||||||
token=gettoken()
|
|
||||||
activityid=getsharetasklist(jdjrcookie,eid,fp,token)
|
|
||||||
inviteinfo=obtainsharetask(jdjrcookie,eid,fp,token,activityid)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
cks = os.environ["JD_COOKIE"].split("&")
|
|
||||||
except:
|
|
||||||
f = open("/jd/config/config.sh", "r", encoding='utf-8')
|
|
||||||
cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
|
|
||||||
f.close()
|
|
||||||
for ck in cks:
|
|
||||||
ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
|
|
||||||
try:
|
|
||||||
if remarkinfos[ptpin]!='':
|
|
||||||
printf("--账号:" + remarkinfos[ptpin] + "--")
|
|
||||||
username=remarkinfos[ptpin]
|
|
||||||
else:
|
|
||||||
printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
|
|
||||||
username=urllib.parse.unquote(ptpin)
|
|
||||||
except:
|
|
||||||
printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
|
|
||||||
username=urllib.parse.unquote(ptpin)
|
|
||||||
UserAgent=randomuserAgent()
|
|
||||||
info=JDSignValidator('https://jrmfp.jr.jd.com/')
|
|
||||||
eid=json.loads(geteid(info[1],info[2]).split('_*')[1])['eid']
|
|
||||||
fp=info[0]
|
|
||||||
token=gettoken()
|
|
||||||
assist(ck,eid,fp,token,inviteinfo.split('@')[0],inviteinfo.split('@')[1])
|
|
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
151
jd_card.js
151
jd_card.js
File diff suppressed because one or more lines are too long
311
jd_ccSign.js
311
jd_ccSign.js
File diff suppressed because one or more lines are too long
885
jd_cfd_fresh.js
885
jd_cfd_fresh.js
File diff suppressed because one or more lines are too long
402
jd_cjhz.js
402
jd_cjhz.js
@ -1,402 +0,0 @@
|
|||||||
/*
|
|
||||||
京东超级盒子
|
|
||||||
更新时间:2022-1-9
|
|
||||||
活动入口:京东APP-搜索-超级盒子
|
|
||||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
|
||||||
============Quantumultx===============
|
|
||||||
[task_local]
|
|
||||||
#京东超级盒子
|
|
||||||
24 3,13 * * * https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js, tag=京东超级盒子, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
|
|
||||||
|
|
||||||
================Loon==============
|
|
||||||
[Script]
|
|
||||||
cron "24 3,13 * * *" script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js,tag=京东超级盒子
|
|
||||||
|
|
||||||
===============Surge=================
|
|
||||||
京东超级盒子 = type=cron,cronexp="24 3,13 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js
|
|
||||||
|
|
||||||
============小火箭=========
|
|
||||||
京东超级盒子 = type=cron,script-path=https://raw.githubusercontent.com/msechen/script/main/jd_cjhz.js, cronexpr="24 3,13 * * *", timeout=3600, enable=true
|
|
||||||
*/
|
|
||||||
|
|
||||||
const $ = new Env('京东超级盒子');
|
|
||||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
//IOS等用户直接用NobyDa的jd cookie
|
|
||||||
let cookiesArr = [],
|
|
||||||
cookie = '',
|
|
||||||
secretp = '',
|
|
||||||
joyToken = "";
|
|
||||||
$.shareCoseList = [];
|
|
||||||
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 () => {
|
|
||||||
console.log('活动入口:京东APP-搜索-超级盒子')
|
|
||||||
console.log('开箱目前结果为空气和红包,没发现豆子')
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
await getToken();
|
|
||||||
cookiesArr = cookiesArr.map(ck => ck + `joyytoken=50084${joyToken};`)
|
|
||||||
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS
|
|
||||||
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;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
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" });
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
|
||||||
console.log(`\n入口:app主页搜超级盒子\n`);
|
|
||||||
await main()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$.shareCoseList = [...new Set([...$.shareCoseList,'QmLpaFXm34BaWgn3C3O2WA','ffn_Yc--WKEab2iPzmVB4BM3VKR8-0h7mdYsY627fC0','c_HK4TBhdsqsRJPgFj7RpA'])]
|
|
||||||
//去助力与开箱
|
|
||||||
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;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
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" });
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if ($.shareCoseList.length >= 2) {
|
|
||||||
for (let y = 0; y < $.shareCoseList.length; y++) {
|
|
||||||
console.log(`京东账号${$.index} ${$.nickName || $.UserName}去助力${$.shareCoseList[y]}`)
|
|
||||||
await helpShare({ "taskId": $.helpId, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": $.shareCoseList[y] });
|
|
||||||
await $.wait(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
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" });
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
//开箱
|
|
||||||
console.log(`京东账号${$.index}去开箱`)
|
|
||||||
for (let y = 0; y < $.lotteryNumber; y++) {
|
|
||||||
console.log(`可以开箱${$.lotteryNumber}次 ==>>第${y+1}次开箱`)
|
|
||||||
await openBox({ "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "" });
|
|
||||||
await $.wait(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
.catch((e) => $.logErr(e))
|
|
||||||
.finally(() => $.done())
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
await superboxSupBoxHomePage({ "taskId": "", "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "" })
|
|
||||||
console.log(`【京东账号${$.index}】${$.nickName || $.UserName}互助码:${$.encryptPin}`)
|
|
||||||
await $.wait(1000);
|
|
||||||
await apTaskList({ "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": $.encryptPin });
|
|
||||||
if ($.allList) {
|
|
||||||
for (let i = 0; i < $.allList.length; i++) {
|
|
||||||
$.oneTask = $.allList[i];
|
|
||||||
if (["SHARE_INVITE"].includes($.oneTask.taskType)) {
|
|
||||||
$.helpId = $.oneTask.id;
|
|
||||||
$.helpLimit = $.oneTask.taskLimitTimes;
|
|
||||||
};
|
|
||||||
if (["BROWSE_SHOP"].includes($.oneTask.taskType) && $.oneTask.taskFinished === false) {
|
|
||||||
await apTaskDetail({ "taskId": $.oneTask.id, "taskType": $.oneTask.taskType, "channel": 4, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "7pcfSWHrAG9MKu3RKLl127VL5L4aIE1sZ1eRRdphpl8" });
|
|
||||||
await $.wait(1000)
|
|
||||||
for (let y = 0; y < ($.doList.status.finishNeed - $.doList.status.userFinishedTimes); y++) {
|
|
||||||
$.startList = $.doList.taskItemList[y];
|
|
||||||
$.itemName = $.doList.taskItemList[y].itemName;
|
|
||||||
console.log(`去浏览${$.itemName}`)
|
|
||||||
await apDoTask({ "taskId": $.allList[i].id, "taskType": $.allList[i].taskType, "channel": 4, "itemId": $.startList.itemId, "linkId": "Ll3Qb2mhCXSEWxruhv8qIw", "encryptPin": "7pcfSWHrAG9MKu3RKLl127VL5L4aIE1sZ1eRRdphpl8" })
|
|
||||||
await $.wait(1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(`任务全部完成`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//活动主页
|
|
||||||
function superboxSupBoxHomePage(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.get(taskGetUrl('superboxSupBoxHomePage', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} superboxSupBoxHomePage API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.code === 0) {
|
|
||||||
$.encryptPin = data.data.encryptPin;
|
|
||||||
$.shareCoseList.push($.encryptPin)
|
|
||||||
$.lotteryNumber = data.data.lotteryNumber
|
|
||||||
} else {
|
|
||||||
console.log(`superboxSupBoxHomePage:${JSON.stringify(data)}\n`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//获取任务列表
|
|
||||||
function apTaskList(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.get(taskGetUrl('apTaskList', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} apTaskList API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.code === 0) {
|
|
||||||
$.allList = data.data
|
|
||||||
//console.log(JSON.stringify($.allList[1]));
|
|
||||||
} else {
|
|
||||||
console.log(`apTaskList错误:${JSON.stringify(data)}\n`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取任务分表
|
|
||||||
function apTaskDetail(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.get(taskGetUrl('apTaskDetail', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} apTaskDetail API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if (data.code === 0) {
|
|
||||||
$.doList = data.data
|
|
||||||
//console.log(JSON.stringify($.doList));
|
|
||||||
} else {
|
|
||||||
console.log(`apTaskDetail错误:${JSON.stringify(data)}\n`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//做任务
|
|
||||||
function apDoTask(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.post(taskPostUrl('apDoTask', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} apDoTask API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
//console.log(JSON.stringify(data));
|
|
||||||
if (data.success === true && data.code === 0) {
|
|
||||||
console.log(`浏览${$.itemName}完成\n已完成${data.data.userFinishedTimes}次\n`)
|
|
||||||
} else if (data.success === false && data.code === 2005) {
|
|
||||||
console.log(`${data.data.errMsg}${data.data.userFinishedTimes}次`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//助力
|
|
||||||
function helpShare(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.get(taskGetUrl('superboxSupBoxHomePage', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} superboxSupBoxHomePage API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
//console.log(JSON.stringify(data));
|
|
||||||
if (data.success === true && data.code === 0) {
|
|
||||||
console.log(`助力成功\n\n`)
|
|
||||||
} else {
|
|
||||||
console.log(`助力失败:${JSON.stringify(data)}\n\n`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//开盲盒
|
|
||||||
function openBox(body) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
$.get(taskGetUrl('superboxOrdinaryLottery', body), (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`)
|
|
||||||
console.log(`${$.name} superboxOrdinaryLottery API请求失败,请检查网路重试`)
|
|
||||||
} else {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
//console.log(JSON.stringify(data));
|
|
||||||
if (data.success === true && data.code === 0 && data.data.rewardType === 2) {
|
|
||||||
console.log(`开箱成功获得${data.data.discount}元红包\n\n`)
|
|
||||||
} else if (data.success === true && data.code === 0 && data.data.rewardType !== 2) {
|
|
||||||
console.log(`开箱成功应该获得了空气${JSON.stringify(data.data)}\n\n`)
|
|
||||||
} else {
|
|
||||||
console.log(`失败:${JSON.stringify(data)}\n\n`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getToken(timeout = 0) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
let url = {
|
|
||||||
url: `https://bh.m.jd.com/gettoken`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': `text/plain;charset=UTF-8`
|
|
||||||
},
|
|
||||||
body: `content={"appname":"50084","whwswswws":"","jdkey":"","body":{"platform":"1"}}`
|
|
||||||
}
|
|
||||||
$.post(url, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
joyToken = data.joyytoken;
|
|
||||||
console.log(`joyToken = ${data.joyytoken}`)
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp);
|
|
||||||
} finally {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, timeout)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function taskGetUrl(functionId, body = {}) {
|
|
||||||
return {
|
|
||||||
url: `${JD_API_HOST}?functionId=${functionId}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform&client=wh5&clientVersion=1.0.0`,
|
|
||||||
//body: `functionId=${functionId}&body=${JSON.stringify(body)}&client=wh5&clientVersion=1.0.0&uuid=ef746bc0663f7ca06cdd1fa724c15451900039cf`,
|
|
||||||
headers: {
|
|
||||||
'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"),
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Origin': 'https://prodev.m.jd.com',
|
|
||||||
'Referer': 'https://pro.m.jd.com/mall/active/j8U2SMhmw3aKgfWwYQfoRR4idTT/index.html?',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function taskPostUrl(functionId, body = {}) {
|
|
||||||
return {
|
|
||||||
url: `${JD_API_HOST}?functionId=${functionId}`,
|
|
||||||
body: `functionId=${functionId}&body=${JSON.stringify(body)}&_t=${Date.now()}&appid=activities_platform&client=wh5&clientVersion=1.0.0`,
|
|
||||||
headers: {
|
|
||||||
'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"),
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Origin': 'https://prodev.m.jd.com',
|
|
||||||
'Referer': 'https://pro.m.jd.com/mall/active/j8U2SMhmw3aKgfWwYQfoRR4idTT/index.html?',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) }
|
|
464
jd_computer.js
464
jd_computer.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
411
jd_desire.js
411
jd_desire.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
327
jd_fanli.js
327
jd_fanli.js
File diff suppressed because one or more lines are too long
353
jd_fcdyj.js
353
jd_fcdyj.js
File diff suppressed because one or more lines are too long
@ -1,488 +0,0 @@
|
|||||||
/*
|
|
||||||
早起福利
|
|
||||||
更新时间:2021-7-8
|
|
||||||
30 6 * * * jd_goodMorning.js
|
|
||||||
*/
|
|
||||||
const $ = new Env("早起福利")
|
|
||||||
const ua = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random()*4+10)}.${Math.ceil(Math.random()*4)};${randomString(40)}`
|
|
||||||
let cookiesArr = []
|
|
||||||
let cookie = ''
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
await requireConfig()
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
if (cookiesArr[i]) {
|
|
||||||
cookie = cookiesArr[i];
|
|
||||||
$.cookie = cookie;
|
|
||||||
$.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
|
|
||||||
}
|
|
||||||
await goodMorning()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
function goodMorning() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
$.get({
|
|
||||||
url: 'https://api.m.jd.com/client.action?functionId=morningGetBean&area=22_1930_50948_52157&body=%7B%22rnVersion%22%3A%224.7%22%2C%22fp%22%3A%22-1%22%2C%22eid%22%3A%22%22%2C%22shshshfp%22%3A%22-1%22%2C%22userAgent%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22referUrl%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%7D&build=167724&client=apple&clientVersion=10.0.6&d_brand=apple&d_model=iPhone12%2C8&eid=eidI1aaf8122bas5nupxDQcTRriWjt7Slv2RSJ7qcn6zrB99mPt31yO9nye2dnwJ/OW%2BUUpYt6I0VSTk7xGpxEHp6sM62VYWXroGATSgQLrUZ4QHLjQw&isBackground=N&joycious=60&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=32280b23f8a48084816d8a6c577c6573c162c174&osVersion=14.4&partner=apple&rfs=0000&scope=01&screen=750%2A1334&sign=0c19e5962cea97520c1ef9a2e67dda60&st=1625354180413&sv=112&uemps=0-0&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJSPYvHJMKdY9TUw/AQc1o/DLA/rOTDwEjG4Ar9s7IY4H6IPf3pAz7rkIVtEeW7XkXSOXGvEtHspPvqFlAueK%2B9dfB7ZbI91M9YYXBBk66bejZnH/W/xDy/aPsq2X3k4dUMOkS4j5GHKOGQO3o2U1rhx5O70ZrLaRm7Jy/DxCjm%2BdyfXX8v8rwKw%3D%3D&uuid=hjudwgohxzVu96krv/T6Hg%3D%3D&wifiBssid=c99b216a4acd3bce759e369eaeeafd7',
|
|
||||||
headers: {
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Accept': '*/*',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
|
||||||
'User-Agent': ua,
|
|
||||||
'Accept-Language': 'zh-Hans-CN;q=1',
|
|
||||||
'Host': 'api.m.jd.com'
|
|
||||||
},
|
|
||||||
}, (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
data = JSON.parse(data)
|
|
||||||
if(data.data){
|
|
||||||
console.log(data.data.bizMsg)
|
|
||||||
}
|
|
||||||
if(data.errorMessage){
|
|
||||||
console.log(data.errorMessage)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr('Error: ', e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function requireConfig() {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
if ($.isNode()) {
|
|
||||||
Object.keys(jdCookieNode).forEach((item) => {
|
|
||||||
if (jdCookieNode[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);
|
|
||||||
}
|
|
||||||
console.log(`共${cookiesArr.length}个京东账号\n`)
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
function Env(t, e) {
|
|
||||||
"undefined" != typeof process && JSON.stringify(process.env).indexOf("GIT_HUB") > -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 (e) {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toStr(t, e = null) {
|
|
||||||
try {
|
|
||||||
return JSON.stringify(t)
|
|
||||||
} catch (e) {
|
|
||||||
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)
|
|
||||||
}
|
|
File diff suppressed because one or more lines are too long
418
jd_health.js
418
jd_health.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,172 +0,0 @@
|
|||||||
/**
|
|
||||||
* 京东-锦鲤红包
|
|
||||||
* 6点后做全部CK
|
|
||||||
* cron: 2 0,1,6 * * *
|
|
||||||
* CK1 HW.ts -> 内部
|
|
||||||
* CK2~n 内部 -> HW.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
import * as dotenv from 'dotenv'
|
|
||||||
import {get, post, getshareCodeHW, o2s, getCookie, wait} from "./TS_USER_AGENTS"
|
|
||||||
|
|
||||||
let rabbitToken: string = process.env.RABBIT_TOKEN || '', tg_id: string = process.env.TG_ID || ''
|
|
||||||
let cookie: string, cookiesArr: string[] = [], res: any, UserName: string
|
|
||||||
let shareCodesSelf: string[] = [], shareCodes: string[] = [], shareCodesHW: string[] = [], fullCode: string[] = [], log: string
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
dotenv.config()
|
|
||||||
cookiesArr = await getCookie()
|
|
||||||
cookiesArr = cookiesArr.slice(0, 1)
|
|
||||||
await join()
|
|
||||||
await help()
|
|
||||||
|
|
||||||
cookiesArr = await getCookie()
|
|
||||||
cookiesArr = cookiesArr.slice(0, 9)
|
|
||||||
if ([0, 1].includes(new Date().getHours())) {
|
|
||||||
await join()
|
|
||||||
}
|
|
||||||
await getShareCodeSelf()
|
|
||||||
await help()
|
|
||||||
})()
|
|
||||||
|
|
||||||
async function join() {
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
try {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
for (let i = 0; i < 3; i++) {
|
|
||||||
try {
|
|
||||||
log = await getLog()
|
|
||||||
res = await api('h5launch', {followShop: 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
|
|
||||||
console.log('活动初始化:', res.data.result.statusDesc)
|
|
||||||
if (res.rtn_code === 0) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('join error', res.rtn_code)
|
|
||||||
await wait(5000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
await wait(5000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getShareCodeSelf(one: boolean = false) {
|
|
||||||
if (one) {
|
|
||||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
|
||||||
return res?.data?.result?.redpacketInfo?.id
|
|
||||||
} else {
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
try {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
res = await api('h5activityIndex', {"isjdapp": 1})
|
|
||||||
console.log('ID:', res.data.result.redpacketInfo.id)
|
|
||||||
shareCodesSelf.push(res.data.result.redpacketInfo.id)
|
|
||||||
} catch (e) {
|
|
||||||
console.log('getShareCodeSelf error', e)
|
|
||||||
}
|
|
||||||
await wait(1000)
|
|
||||||
}
|
|
||||||
o2s(shareCodesSelf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function help() {
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
try {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
if (shareCodesHW.length === 0) {
|
|
||||||
shareCodesHW = await getshareCodeHW('jlhb')
|
|
||||||
}
|
|
||||||
if (index === 0) {
|
|
||||||
shareCodes = Array.from(new Set([...shareCodesHW, ...shareCodesSelf]))
|
|
||||||
} else {
|
|
||||||
shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
|
|
||||||
}
|
|
||||||
|
|
||||||
let me: string = await getShareCodeSelf(true), remain: boolean = true
|
|
||||||
for (let code of shareCodes) {
|
|
||||||
if (!remain) break
|
|
||||||
let success: boolean = false
|
|
||||||
if (!fullCode.includes(code) && code !== me) {
|
|
||||||
console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`)
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
if (success) break
|
|
||||||
log = await getLog()
|
|
||||||
res = await api('jinli_h5assist', {"redPacketId": code, "followShop": 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
|
|
||||||
if (res.rtn_code !== 0) {
|
|
||||||
console.log('help error', res.rtn_code)
|
|
||||||
await wait(5000)
|
|
||||||
} else {
|
|
||||||
success = true
|
|
||||||
if (res.data.result.status === 0) {
|
|
||||||
console.log('助力成功:', parseFloat(res.data.result.assistReward.discount))
|
|
||||||
await wait(45000)
|
|
||||||
remain = false
|
|
||||||
break
|
|
||||||
} else if (res.data.result.status === 3) {
|
|
||||||
console.log('今日助力次数已满')
|
|
||||||
remain = false
|
|
||||||
await wait(45000)
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
console.log('助力结果:', res.data.result.statusDesc)
|
|
||||||
if (res.data.result.statusDesc === '啊偶,TA的助力已满,开启自己的红包活动吧~') {
|
|
||||||
fullCode.push(code)
|
|
||||||
}
|
|
||||||
await wait(45000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
await wait(5000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function api(fn: string, body: object) {
|
|
||||||
return await post(`https://api.m.jd.com/api?appid=jinlihongbao&functionId=${fn}&loginType=2&client=jinlihongbao&clientVersion=10.2.4&osVersion=AndroidOS&d_brand=Xiaomi&d_model=Xiaomi`, `body=${encodeURIComponent(JSON.stringify(body))}`, {
|
|
||||||
"origin": "https://h5.m.jd.com",
|
|
||||||
"referer": "https://h5.m.jd.com/babelDiy/Zeus/2NUvze9e1uWf4amBhe1AV6ynmSuH/index.html",
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
"X-Requested-With": "com.jingdong.app.mall",
|
|
||||||
"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",
|
|
||||||
"MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
|
|
||||||
][Math.floor(Math.random() * 2)], "Cookie": cookie,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getLog() {
|
|
||||||
if (!rabbitToken && !tg_id) {
|
|
||||||
let data = await get(`https://api.jdsharecode.xyz/api/jlhb`)
|
|
||||||
if (data !== 1 && data !== '1') {
|
|
||||||
return data
|
|
||||||
} else {
|
|
||||||
console.log('No log')
|
|
||||||
process.exit(0)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('rabbit log')
|
|
||||||
let data: any = ''
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
try {
|
|
||||||
data = await get(`http://www.madrabbit.cf:8080/license/log?tg_id=${tg_id}&token=${rabbitToken}`)
|
|
||||||
break
|
|
||||||
} catch (e) {
|
|
||||||
console.log('rabbit log api error')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return `'"random":"${data.data.random}","log":"${data.data.log}"'`
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,229 +0,0 @@
|
|||||||
/**
|
|
||||||
汪汪乐园-跑步+组队
|
|
||||||
默认翻倍到0.04红包结束,修改请设置变量
|
|
||||||
export JD_JOY_PARK_RUN_ASSETS="0.08"
|
|
||||||
32 * * * * jd_joy_joy_run.ts
|
|
||||||
new Env('极速版汪汪赛跑')
|
|
||||||
Modify By Dylan from HW
|
|
||||||
**/
|
|
||||||
|
|
||||||
import {get, post, o2s, requireConfig, wait} from './TS_USER_AGENTS'
|
|
||||||
import {H5ST} from "./function/h5st"
|
|
||||||
import {existsSync, readFileSync} from "fs";
|
|
||||||
import {getDate} from "date-fns";
|
|
||||||
|
|
||||||
let cookie: string = '', res: any = '', UserName: string = '', fp_448de: string = '' || process.env.FP_448DE, fp_b6ac3: string = '' || process.env.FP_B6AC3
|
|
||||||
let assets: number = 0, captainId: string = '', h5stTool: H5ST = null
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
let cookiesArr: string[] = await requireConfig()
|
|
||||||
let account: { pt_pin: string, joy_park_run: number }[] = []
|
|
||||||
console.log('每周日18点组队分红!!')
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
assets = parseFloat(process.env.JD_JOY_PARK_RUN_ASSETS || '0.04')
|
|
||||||
let rewardAmount: number = 0
|
|
||||||
try {
|
|
||||||
h5stTool = new H5ST('448de', 'jdltapp;', fp_448de)
|
|
||||||
await h5stTool.__genAlgo()
|
|
||||||
res = await team('runningMyPrize', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "pageSize": 20, "time": null, "ids": null})
|
|
||||||
let sum: number = 0, success: number = 0
|
|
||||||
for (let t of res?.data?.detailVos || []) {
|
|
||||||
if (t.amount > 0 && getDate(new Date(t.createTime)) === new Date().getDate()) {
|
|
||||||
sum = add(sum, t.amount)
|
|
||||||
success++
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log('今日成功', success, '次')
|
|
||||||
console.log('今日收益', sum.toFixed(2), '元')
|
|
||||||
|
|
||||||
res = await team('runningTeamInfo', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
|
||||||
if (!captainId) {
|
|
||||||
if (res.data.members.length === 0) {
|
|
||||||
console.log('成为队长')
|
|
||||||
captainId = res.data.captainId
|
|
||||||
} else if (res.data.members.length !== 6) {
|
|
||||||
console.log('队伍未满', res.data.members.length, '人')
|
|
||||||
console.log('战队收益', res.data.teamSumPrize, '元')
|
|
||||||
captainId = res.data.captainId
|
|
||||||
} else {
|
|
||||||
console.log('队伍已满', res.data.members.length, '人')
|
|
||||||
console.log('战队收益', res.data.teamSumPrize, '元')
|
|
||||||
}
|
|
||||||
} else if (captainId && res.data.members.length === 0) {
|
|
||||||
console.log('已有组队ID,未加入队伍')
|
|
||||||
res = await team('runningJoinTeam', {"linkId": "L-sOanK_5RJCz7I314FpnQ", "captainId": captainId})
|
|
||||||
if (res.code === 0) {
|
|
||||||
console.log('组队成功')
|
|
||||||
for (let member of res.data.members) {
|
|
||||||
if (member.captain) {
|
|
||||||
console.log('队长', member.nickName)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (res.data.members.length === 6) {
|
|
||||||
console.log('队伍已满')
|
|
||||||
captainId = ''
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
o2s(res, '组队失败')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('已组队', res.data.members.length, '人')
|
|
||||||
console.log('战队收益', res.data.teamSumPrize, '元')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
h5stTool = new H5ST('b6ac3', 'jdltapp;', fp_b6ac3)
|
|
||||||
await h5stTool.__genAlgo()
|
|
||||||
res = await runningPageHome()
|
|
||||||
console.log('🧧总金额', res.data.runningHomeInfo.prizeValue, '元')
|
|
||||||
|
|
||||||
let energy: number = res.data.runningHomeInfo.energy
|
|
||||||
console.log('💊 X', res.data.runningHomeInfo.energy, '个能量棒')
|
|
||||||
await wait(2000)
|
|
||||||
if (res.data.runningHomeInfo.nextRunningTime){
|
|
||||||
console.log('⏳体力恢复中,还有', secondsToMinutes(res.data.runningHomeInfo.nextRunningTime / 1000))
|
|
||||||
if (res.data.runningHomeInfo.nextRunningTime / 1000 < 300) {
|
|
||||||
await wait(res.data.runningHomeInfo.nextRunningTime)
|
|
||||||
res = await runningPageHome()
|
|
||||||
console.log('体力恢复完成,开始跑步....')
|
|
||||||
await wait(1000)
|
|
||||||
} else {
|
|
||||||
console.log('⏳等体力恢复在跑吧!');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('体力已恢复,开始跑步....')
|
|
||||||
}
|
|
||||||
|
|
||||||
await startRunning(res, assets)
|
|
||||||
for (let i = 0; i < energy; i++) {
|
|
||||||
console.log('💉消耗能量棒跑步....')
|
|
||||||
res = await api('runningUseEnergyBar', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
|
||||||
//console.log(res.errMsg)
|
|
||||||
res = await runningPageHome()
|
|
||||||
await startRunning(res, assets)
|
|
||||||
await wait(1000)
|
|
||||||
}
|
|
||||||
res = await runningPageHome()
|
|
||||||
console.log('🧧总金额', res.data.runningHomeInfo.prizeValue, '元')
|
|
||||||
await wait(2000)
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Error', e)
|
|
||||||
await wait(3000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
async function startRunning(res: any, assets: number) {
|
|
||||||
if (!res.data.runningHomeInfo.nextRunningTime) {
|
|
||||||
console.log('终点目标', assets)
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
res = await api('runningOpenBox', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
|
||||||
if (parseFloat(res.data.assets) >= assets) {
|
|
||||||
let assets: number = parseFloat(res.data.assets)
|
|
||||||
res = await api('runningPreserveAssets', {"linkId": "L-sOanK_5RJCz7I314FpnQ"})
|
|
||||||
console.log('领取成功', assets)
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
if (res.data.doubleSuccess) {
|
|
||||||
console.log('翻倍成功', parseFloat(res.data.assets))
|
|
||||||
await wait(10000)
|
|
||||||
} else if (!res.data.doubleSuccess && !res.data.runningHomeInfo.runningFinish) {
|
|
||||||
console.log('开始跑步', parseFloat(res.data.assets))
|
|
||||||
await wait(10000)
|
|
||||||
} else {
|
|
||||||
console.log('翻倍失败')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await wait(3000)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function api(fn: string, body: object) {
|
|
||||||
let timestamp: number = Date.now(), h5st: string = ''
|
|
||||||
if (fn === 'runningOpenBox') {
|
|
||||||
h5st = h5stTool.__genH5st({
|
|
||||||
appid: "activities_platform",
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
client: "ios",
|
|
||||||
clientVersion: "3.1.0",
|
|
||||||
functionId: "runningOpenBox",
|
|
||||||
t: timestamp.toString()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let params: string = `functionId=${fn}&body=${JSON.stringify(body)}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1`
|
|
||||||
h5st && (params += `&h5st=${h5st}`)
|
|
||||||
return await post('https://api.m.jd.com/', params, {
|
|
||||||
'authority': 'api.m.jd.com',
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'cookie': cookie,
|
|
||||||
'origin': 'https://h5platform.jd.com',
|
|
||||||
'referer': 'https://h5platform.jd.com/',
|
|
||||||
'user-agent': 'jdltapp;'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runningPageHome() {
|
|
||||||
return get(`https://api.m.jd.com/?functionId=runningPageHome&body=%7B%22linkId%22:%22L-sOanK_5RJCz7I314FpnQ%22,%22isFromJoyPark%22:true,%22joyLinkId%22:%22LsQNxL7iWDlXUs6cFl-AAg%22%7D&t=${Date.now()}&appid=activities_platform&client=ios&clientVersion=3.1.0`, {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Origin': 'https://h5platform.jd.com',
|
|
||||||
'User-Agent': 'jdltapp;',
|
|
||||||
'Referer': 'https://h5platform.jd.com/',
|
|
||||||
'Cookie': cookie
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function team(fn: string, body: object) {
|
|
||||||
let timestamp: number = Date.now(), h5st: string
|
|
||||||
h5st = h5stTool.__genH5st({
|
|
||||||
appid: "activities_platform",
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
client: "ios",
|
|
||||||
clientVersion: "3.1.0",
|
|
||||||
functionId: fn,
|
|
||||||
t: timestamp.toString()
|
|
||||||
})
|
|
||||||
return await get(`https://api.m.jd.com/?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&t=${timestamp}&appid=activities_platform&client=ios&clientVersion=3.1.0&cthr=1&h5st=${h5st}`, {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'User-Agent': 'jdltapp;',
|
|
||||||
'Origin': 'https://h5platform.jd.com',
|
|
||||||
'X-Requested-With': 'com.jd.jdlite',
|
|
||||||
'Referer': 'https://h5platform.jd.com/',
|
|
||||||
'Cookie': cookie
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 秒转时分秒
|
|
||||||
function secondsToMinutes(seconds: number) {
|
|
||||||
let minutes: number = Math.floor(seconds / 60)
|
|
||||||
let second: number = Math.floor(seconds % 60)
|
|
||||||
return `${minutes}分${second}秒`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 小数加法
|
|
||||||
function add(num1: number, num2: number) {
|
|
||||||
let r1: number, r2: number
|
|
||||||
try {
|
|
||||||
r1 = num1.toString().split('.')[1].length
|
|
||||||
} catch (e) {
|
|
||||||
r1 = 0
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
r2 = num2.toString().split('.')[1].length
|
|
||||||
} catch (e) {
|
|
||||||
r2 = 0
|
|
||||||
}
|
|
||||||
let m: number = Math.pow(10, Math.max(r1, r2))
|
|
||||||
return (num1 * m + num2 * m) / m
|
|
||||||
}
|
|
393
jd_live.js
393
jd_live.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
390
jd_ljd_xh.js
390
jd_ljd_xh.js
@ -1,390 +0,0 @@
|
|||||||
/*
|
|
||||||
* 领京豆,修复死循环
|
|
||||||
* By X1a0He
|
|
||||||
* https://github.com/X1a0He/jd_scripts_fixed
|
|
||||||
* */
|
|
||||||
const $ = new Env("领京豆");
|
|
||||||
const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
let cookiesArr = [], cookie = "", message = ``;
|
|
||||||
$.taskInfos = [];
|
|
||||||
$.viewAppHome = false;
|
|
||||||
$.isLogin = true;
|
|
||||||
$.addedGrowth = 0;
|
|
||||||
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"), ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie),].filter((item) => !!item);
|
|
||||||
!(async() => {
|
|
||||||
if(!cookiesArr[0]){
|
|
||||||
$.msg($.name, "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", "https://bean.m.jd.com/", { "open-url": "https://bean.m.jd.com/" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
message += `[京东账号${$.index} ${$.UserName}] \n`;
|
|
||||||
console.log(`[京东账号${$.index} ${$.UserName}] 正在执行...`);
|
|
||||||
await main();
|
|
||||||
message += `\n`
|
|
||||||
await $.wait(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($.isNode()){
|
|
||||||
console.log('正在发送通知...')
|
|
||||||
await notify.sendNotify(`${$.name}`, `${message}`)
|
|
||||||
}
|
|
||||||
})().catch((e) => {
|
|
||||||
$.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "");
|
|
||||||
}).finally(() => {
|
|
||||||
$.done();
|
|
||||||
});
|
|
||||||
|
|
||||||
function taskUrl_xh(functionId, body){
|
|
||||||
return {
|
|
||||||
"url": `https://api.m.jd.com/client.action?functionId=${functionId}&body=${encodeURIComponent(body)}&appid=ld&client=m&clientVersion=9.4.4`,
|
|
||||||
'headers': {
|
|
||||||
'Cookie': cookie,
|
|
||||||
'UserAgent': 'User-Agent: jdapp;JD4iPhone/167724 (iPhone; iOS 15.0; Scale/3.00)',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main(){
|
|
||||||
$.addedGrowth = 0;
|
|
||||||
$.isLogin = true;
|
|
||||||
// 先领取早起福利
|
|
||||||
console.log(`尝试领取早起福利...`)
|
|
||||||
await taskRequest("morningGetBean", `{"fp":"-1","shshshfp":"-1","shshshfpa":"-1","referUrl":"-1","userAgent":"-1","jda":"-1","rnVersion":"3.9"}`)
|
|
||||||
// 获取任务列表
|
|
||||||
if($.isLogin){
|
|
||||||
do {
|
|
||||||
$.taskInfos = []
|
|
||||||
await taskRequest("beanTaskList", `{"viewChannel":"AppHome"}`)
|
|
||||||
// 获取完任务列表就开始做任务了
|
|
||||||
for(let task of $.taskInfos){
|
|
||||||
// 任务未完成
|
|
||||||
if(task.status === 1){
|
|
||||||
for(let subTask of task.subTaskVOS){
|
|
||||||
if(subTask.status === 1){
|
|
||||||
console.log(`[${task.taskName}] 正在做任务...`)
|
|
||||||
if(task.waitDuration !== 0){
|
|
||||||
await taskRequest("beanDoTask", `{"actionType":1,"taskToken":"${subTask.taskToken}"}`)
|
|
||||||
console.log(`[${task.taskName}] 等待 ${task.waitDuration} 秒`)
|
|
||||||
await $.wait(task.waitDuration * 1000)
|
|
||||||
await taskRequest("beanDoTask", `{"actionType":0,"taskToken":"${subTask.taskToken}"}`)
|
|
||||||
} else await taskRequest("beanDoTask", `{"actionType":0,"taskToken":"${subTask.taskToken}"}`)
|
|
||||||
}
|
|
||||||
await $.wait(3000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while($.taskInfos.length !== 0);
|
|
||||||
// 从京东首页领京豆进入
|
|
||||||
if(!$.viewAppHome){
|
|
||||||
console.log(`[从京东首页领京豆进入] 正在做任务...`)
|
|
||||||
await taskRequest("beanHomeIconDoTask", `{"flag":"0","viewChannel":"AppHome"}`)
|
|
||||||
if(!$.viewAppHome){
|
|
||||||
await $.wait(2000)
|
|
||||||
await taskRequest("beanHomeIconDoTask", `{"flag":"1","viewChannel":"AppHome"}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
message += `[本次执行] 获得成长值:${$.addedGrowth}\n`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function taskRequest(functionId, body){
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
let options = taskUrl_xh(functionId, body);
|
|
||||||
$.get(options, (err, resp, data) => {
|
|
||||||
try{
|
|
||||||
if(safeGet(data)){
|
|
||||||
data = JSON.parse(data);
|
|
||||||
if(data.code === "3"){
|
|
||||||
console.log(`用户未登录`)
|
|
||||||
message += `用户未登录`
|
|
||||||
$.isLogin = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(data.code === "0"){
|
|
||||||
switch(functionId){
|
|
||||||
case "morningGetBean":
|
|
||||||
if(data.data.awardResultFlag === "1"){
|
|
||||||
console.log(`${data.data.bizMsg}, 获得京豆 ${data.data.beanNum} 个\n`)
|
|
||||||
message += `[早起福利] 获得京豆 ${data.data.beanNum} 个\n`
|
|
||||||
} else {
|
|
||||||
console.log(`执行失败,原因:${data.data.bizMsg}\n`)
|
|
||||||
message += `[早起福利] ${data.data.bizMsg} \n`
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "beanTaskList" :
|
|
||||||
for(let task of data.data.taskInfos) task.status === 1 ? $.taskInfos.push(task) : ''
|
|
||||||
$.viewAppHome = data.data.viewAppHome.doneTask
|
|
||||||
break;
|
|
||||||
case "beanDoTask" :
|
|
||||||
if(typeof data.errorCode === "undefined"){
|
|
||||||
if(data.data.taskStatus === 1 || data.data.taskStatus === 2){
|
|
||||||
console.log(`${data.data.bizMsg}\n`)
|
|
||||||
$.addedGrowth += data.data.growthResult.addedGrowth
|
|
||||||
}
|
|
||||||
} else console.log(`${data.data.errorMessage}\n`)
|
|
||||||
break;
|
|
||||||
case "beanHomeIconDoTask":
|
|
||||||
if(typeof data.errorCode === "undefined"){
|
|
||||||
$.addedGrowth += 50;
|
|
||||||
console.log(`${data.data.remindMsg}\n`)
|
|
||||||
} else console.log(`${data.errorMessage}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch(e){
|
|
||||||
console.log(e);
|
|
||||||
} finally{
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function safeGet(data){
|
|
||||||
try{
|
|
||||||
if(typeof JSON.parse(data) == "object"){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch(e){
|
|
||||||
console.log(e);
|
|
||||||
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
}
|
|
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
172
jd_mfredrain.js
172
jd_mfredrain.js
File diff suppressed because one or more lines are too long
182
jd_mofang.ts
182
jd_mofang.ts
@ -1,182 +0,0 @@
|
|||||||
/**
|
|
||||||
* const $ = new Env('京东新品-集魔方兑换-本地log版');
|
|
||||||
* cron: 10 8 * * *
|
|
||||||
* Fix by HarbourJ
|
|
||||||
* TG: https://t.me/HarbourToulu
|
|
||||||
* 默认魔方满3/6自动兑换
|
|
||||||
* 已内置log,不定时更新,若火爆请在HarbourTouluChat反馈以便及时更新log。
|
|
||||||
*/
|
|
||||||
|
|
||||||
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 mf_logs: any, logApi: boolean = false // 若有log接口请改为true并修改line174接口地址
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
dotenv.config()
|
|
||||||
if (existsSync('./utils/mf_log.ts')) {
|
|
||||||
mf_logs = require('./utils/mf_log').mf_logs
|
|
||||||
} else {
|
|
||||||
console.log('./utils/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`)
|
|
||||||
if (logApi === true) {
|
|
||||||
console.log("开启船长🛳偷撸模式")
|
|
||||||
}
|
|
||||||
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, reward: string = res.result.taskConfig.projectPoolId, rewardSign: string = res.result.giftConfig.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 === '去新品频道逛逛') {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res = await api(`functionId=queryInteractiveRewardInfo&body=${encodeURIComponent(JSON.stringify({"encryptProjectPoolId":reward,"sourceCode":"acexinpin0823","ext":{"needPoolRewards":1,"needExchangeRestScore":1}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
|
|
||||||
let sum: number = res.exchangeRestScoreMap["368"]
|
|
||||||
console.log('当前碎片', sum+'片')
|
|
||||||
if (sum >= 6) {
|
|
||||||
for (let k = 1; k <= Math.floor(sum / 6); k++) {
|
|
||||||
console.log(`开始第${k}次收集魔方`)
|
|
||||||
log = await getLog()
|
|
||||||
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({"encryptProjectId": rewardSign, "encryptAssignmentId": "wE62TwscdA52Z4WkpTJq7NaMvfw", "sourceCode": "acexinpin0823", "itemId": "", "actionType": "", "completionFlag": "", "ext": {"exchangeNum": 1}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFDHh5"}})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
|
|
||||||
if (res.subCode === '0') {
|
|
||||||
console.log('收集成功')
|
|
||||||
} else {
|
|
||||||
console.log('收集失败', res.msg)
|
|
||||||
}
|
|
||||||
await wait(3000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res = await api(`functionId=queryInteractiveRewardInfo&body=${encodeURIComponent(JSON.stringify({"encryptProjectId": rewardSign, "sourceCode": "acexinpin0823", "ext": {"needExchangeRestScore": "1"}}))}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
|
|
||||||
let score: number = res.exchangeRestScoreMap["367"]
|
|
||||||
console.log('当前魔方', score+'个')
|
|
||||||
if (score >= 6) {
|
|
||||||
log = await getLog()
|
|
||||||
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({"encryptProjectId": rewardSign, "encryptAssignmentId": "42pP1FaQ4FTMurVsJpZhiFJXCZox", "sourceCode": "acexinpin0823", "itemId": "", "actionType": "", "completionFlag": "", "ext": {"exchangeNum": 1}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFDHh5"}})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
|
|
||||||
if (res.subCode === '0') {
|
|
||||||
console.log('兑换6魔方成功:', res.rewardsInfo.successRewards['3'][0].rewardName)
|
|
||||||
score -= 6
|
|
||||||
} else {
|
|
||||||
console.log('兑换6魔方失败:', res.msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (score >= 3) {
|
|
||||||
log = await getLog()
|
|
||||||
res = await api(`functionId=doInteractiveAssignment&body=${JSON.stringify({"encryptProjectId": rewardSign, "encryptAssignmentId": "khdCzL9YRdYjh3dWFXfZLteUTYu", "sourceCode": "acexinpin0823", "itemId": "", "actionType": "", "completionFlag": "", "ext": {"exchangeNum": 1}, "extParam": {"businessData": {"random": log.match(/"random":"(\d+)"/)[1]}, "signStr": log.match(/"log":"(.*)"/)[1], "sceneid": "XMFDHh5"}})}&client=wh5&clientVersion=1.0.0&appid=content_ecology`)
|
|
||||||
if (res.subCode === '0') {
|
|
||||||
console.log('兑换3魔方成功:', res.rewardsInfo.successRewards['3'][0].rewardName)
|
|
||||||
score -= 3
|
|
||||||
console.log('剩余魔方', score+'个')
|
|
||||||
} else {
|
|
||||||
console.log('兑换3魔方失败:', res.msg)
|
|
||||||
console.log('剩余魔方', score+'个')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(`当前只有${score}个魔方,不够兑换`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
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 (logApi === true) {
|
|
||||||
let data = await get("此处填写logApi") //若有,请把log接口填写在此处
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
885
jd_moneyTree.js
885
jd_moneyTree.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
584
jd_nnfls.js
584
jd_nnfls.js
@ -1,584 +0,0 @@
|
|||||||
/**
|
|
||||||
京喜-首页-牛牛福利
|
|
||||||
Author:zxx
|
|
||||||
Date:2021-11-2
|
|
||||||
-----------------
|
|
||||||
Update: 2021-11-17 修复任务
|
|
||||||
-----------------
|
|
||||||
先内部助力,有剩余助力作者
|
|
||||||
cron 1 0,19,23 * * * https://raw.githubusercontent.com/ZXX2021/jd-scripts/main/jd_nnfls.js
|
|
||||||
*/
|
|
||||||
const $ = new Env('牛牛福利');
|
|
||||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
|
||||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
|
||||||
const CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
|
|
||||||
let cookiesArr = [];
|
|
||||||
let shareCodes = [];
|
|
||||||
let rcsArr = [];
|
|
||||||
let coin = 0;
|
|
||||||
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"),
|
|
||||||
...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)
|
|
||||||
].filter((item) => !!item);
|
|
||||||
};
|
|
||||||
!(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;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
$.index = i + 1;
|
|
||||||
$.cookie = cookiesArr[i];
|
|
||||||
$.isLogin = true;
|
|
||||||
$.nickName = '';
|
|
||||||
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
|
||||||
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
|
|
||||||
}
|
|
||||||
res = await UserSignNew();
|
|
||||||
// await drawUserTask();
|
|
||||||
}
|
|
||||||
shareCodes = shareCodes.filter(code => code)
|
|
||||||
const author = Math.random() > 0.5 ? 'zero205' : 'ZXX2021'
|
|
||||||
await getShareCode('nnfls.json', author, 3, true)
|
|
||||||
shareCodes = [...new Set([...shareCodes, ...($.shareCode || [])])];
|
|
||||||
if (shareCodes.length > 0) {
|
|
||||||
console.log(`\n*********开始互助**********\n`);
|
|
||||||
}
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
$.cookie = cookiesArr[i];
|
|
||||||
$.canHelp = true;
|
|
||||||
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
|
||||||
console.log(`====开始账号${$.UserName}===助力`)
|
|
||||||
if (rcsArr.includes($.UserName) > 0) {
|
|
||||||
console.log("不让助力,休息会!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (let j = 0; j < shareCodes.length; j++) {
|
|
||||||
if (!$.canHelp) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
await help(shareCodes[j]);
|
|
||||||
await $.wait(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(`\n********执行任务抽奖**********\n`);
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
|
||||||
$.cookie = cookiesArr[i];
|
|
||||||
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
|
||||||
console.log(`====开始账号${$.UserName}===`)
|
|
||||||
if (rcsArr.includes($.UserName) > 0) {
|
|
||||||
console.log("不让做任务,休息会!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
await drawUserTask();
|
|
||||||
}
|
|
||||||
|
|
||||||
})().catch((e) => { $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') }).finally(() => { $.done(); })
|
|
||||||
|
|
||||||
function getShareCode(name, author = 'zero205', num = -1, shuffle = false) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
$.get({
|
|
||||||
url: `https://raw.fastgit.org/${author}/updateTeam/main/shareCodes/${name}`,
|
|
||||||
headers: {
|
|
||||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
|
|
||||||
}
|
|
||||||
}, async (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (err) {
|
|
||||||
console.log(`${JSON.stringify(err)}`);
|
|
||||||
console.log(`${$.name} API请求失败,请检查网路重试`);
|
|
||||||
} else {
|
|
||||||
console.log(`优先账号内部互助,有剩余助力次数再帮作者助力`);
|
|
||||||
$.shareCode = JSON.parse(data) || []
|
|
||||||
if (shuffle) {
|
|
||||||
$.shareCode = $.shareCode.sort(() => 0.5 - Math.random())
|
|
||||||
}
|
|
||||||
if (num != -1) {
|
|
||||||
$.shareCode = $.shareCode.slice(0, num)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
$.logErr(e, resp)
|
|
||||||
} finally {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function help(sharecode) {
|
|
||||||
console.log(`${$.UserName} 去助力 ${sharecode}`)
|
|
||||||
res = await api('sign/helpSign', 'flag,sceneval,token', { flag: 0, token: sharecode })
|
|
||||||
await $.wait(3000)
|
|
||||||
res = await api('sign/helpSign', 'flag,sceneval,token', { flag: 1, token: sharecode })
|
|
||||||
if (res) {
|
|
||||||
switch (res.retCode) {
|
|
||||||
case 30014:
|
|
||||||
console.log('不能助力自己');
|
|
||||||
break;
|
|
||||||
case 30010:
|
|
||||||
console.log('助力已满!');
|
|
||||||
break;
|
|
||||||
case 30011:
|
|
||||||
console.log('助力次数已用完!');
|
|
||||||
$.canHelp = false;
|
|
||||||
break;
|
|
||||||
case 30009:
|
|
||||||
console.log('已助力过!');
|
|
||||||
break;
|
|
||||||
case 60009:
|
|
||||||
console.log('不让助力,先休息会!');
|
|
||||||
rcsArr.push($.UserName);
|
|
||||||
$.canHelp = false;
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
console.log('助力成功');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log('助力结果' + res.errMsg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('助力失败!');
|
|
||||||
}
|
|
||||||
await $.wait(2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function drawUserTask() {
|
|
||||||
res = await api('task/QueryUserTask', 'sceneval,taskType', { taskType: 0 })
|
|
||||||
let tasks = []
|
|
||||||
if (res.datas) {
|
|
||||||
for (let t of res.datas) {
|
|
||||||
if (t.state !== 2)
|
|
||||||
tasks.push(t.taskid ? t.taskid : t.taskId)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res = await api('task/QueryPgTaskCfg', 'sceneval', {})
|
|
||||||
if (tasks.length === 0) {
|
|
||||||
for (let t of res.data.tasks) {
|
|
||||||
tasks.push(t.taskid ? t.taskid : t.taskId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(`总任务数:${res.datas && res.datas.length} 本次执行任务数: ${tasks && tasks.length}`)
|
|
||||||
await $.wait(2000)
|
|
||||||
|
|
||||||
res = await api('task/QueryPgTaskCfg', 'sceneval', {})
|
|
||||||
// console.log('tasks:', res.data.tasks && res.data.tasks.length)
|
|
||||||
// await $.wait(2000)
|
|
||||||
for (let t of res.data.tasks) {
|
|
||||||
if (tasks.includes(t.taskid ? t.taskid : t.taskId)) {
|
|
||||||
let sleep = (t.param7 ? t.param7 : 2) * 1000 + (Math.random() * 5 + 1) * 1000;
|
|
||||||
console.log(`任务名:${t.taskName} 浏览时间:${sleep / 1000} s`)
|
|
||||||
res = await api('task/drawUserTask', 'sceneval,taskid', { taskid: t.taskid ? t.taskid : t.taskId })
|
|
||||||
await $.wait(sleep)
|
|
||||||
res = await api('task/UserTaskFinish', 'sceneval,taskid', { taskid: t.taskid ? t.taskid : t.taskId })
|
|
||||||
// console.log(`${JSON.stringify(res)}`)
|
|
||||||
await $.wait(2000)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
res = await api('active/LuckyTwistUserInfo', 'sceneval', {})
|
|
||||||
let surplusTimes = res.data.surplusTimes
|
|
||||||
console.log('剩余抽奖次数', surplusTimes)
|
|
||||||
for (let j = 0; j < surplusTimes && coin >= 10; j++) {
|
|
||||||
res = await api('active/LuckyTwistDraw', 'active,activedesc,sceneval', { active: 'rwjs_fk1111', activedesc: encodeURIComponent('幸运扭蛋机抽奖') })
|
|
||||||
if (res) {
|
|
||||||
if (res.retCode == 0) {
|
|
||||||
console.log('抽奖成功', res.data && res.data.prize ? res.data.prize[0].prizename : "")
|
|
||||||
} else {
|
|
||||||
console.log('抽奖失败', res.errMsg ? res.errMsg : "")
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
console.log('抽奖失败,返回数据为空')
|
|
||||||
}
|
|
||||||
coin -= 10
|
|
||||||
await $.wait(5000)
|
|
||||||
}
|
|
||||||
await $.wait(2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function UserSignNew() {
|
|
||||||
let fn = "sign/UserSignNew";
|
|
||||||
let stk = "sceneval,source";
|
|
||||||
let params = { source: '' };
|
|
||||||
let res = await api(fn, stk, params);
|
|
||||||
if (res) {
|
|
||||||
if (res.retCode == 60009) {
|
|
||||||
console.log('风控用户,不让玩')
|
|
||||||
rcsArr.push($.UserName);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
console.log('签到', res.retCode == 0 ? "success" : "fail")
|
|
||||||
console.log('助力码', res.data.token)
|
|
||||||
shareCodes.push(res.data.token);
|
|
||||||
coin = res.data.pgAmountTotal
|
|
||||||
console.log('金币', coin)
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function decrypturl(url, stk, params, appId = 10012) {
|
|
||||||
for (const [key, val] of Object.entries(params)) {
|
|
||||||
url += `&${key}=${val}`
|
|
||||||
}
|
|
||||||
url += '&h5st=' + decrypt(url, stk, appId)
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
|
|
||||||
function decrypt(url, stk, appId) {
|
|
||||||
stk = stk || (url ? getJxmcUrlData(url, '_stk') : '')
|
|
||||||
if (stk) {
|
|
||||||
const timestamp = new Date().Format("yyyyMMddhhmmssSSS");
|
|
||||||
let hash1 = '';
|
|
||||||
if ($.fingerprint && $.Jxmctoken && $.enCryptMethodJD) {
|
|
||||||
hash1 = $.enCryptMethodJD($.Jxmctoken, $.fingerprint.toString(), timestamp.toString(), appId.toString(), CryptoJS).toString(CryptoJS.enc.Hex);
|
|
||||||
} else {
|
|
||||||
const random = '5gkjB6SpmC9s';
|
|
||||||
$.Jxmctoken = `tk01wcdf61cb3a8nYUtHcmhSUFFCfddDPRvKvYaMjHkxo6Aj7dhzO+GXGFa9nPXfcgT+mULoF1b1YIS1ghvSlbwhE0Xc`;
|
|
||||||
$.fingerprint = 5287160221454703;
|
|
||||||
const str = `${$.Jxmctoken}${$.fingerprint}${timestamp}${appId}${random}`;
|
|
||||||
hash1 = CryptoJS.SHA512(str, $.Jxmctoken).toString(CryptoJS.enc.Hex);
|
|
||||||
}
|
|
||||||
let st = '';
|
|
||||||
stk.split(',').map((item, index) => {
|
|
||||||
st += `${item}:${getJxmcUrlData(url, item)}${index === stk.split(',').length - 1 ? '' : '&'}`;
|
|
||||||
})
|
|
||||||
const hash2 = CryptoJS.HmacSHA256(st, hash1.toString()).toString(CryptoJS.enc.Hex);
|
|
||||||
return encodeURIComponent(["".concat(timestamp.toString()), "".concat($.fingerprint.toString()), "".concat(appId.toString()), "".concat($.Jxmctoken), "".concat(hash2)].join(";"))
|
|
||||||
} else {
|
|
||||||
return '20210318144213808;8277529360925161;10001;tk01w952a1b73a8nU0luMGtBanZTHCgj0KFVwDa4n5pJ95T/5bxO/m54p4MtgVEwKNev1u/BUjrpWAUMZPW0Kz2RWP8v;86054c036fe3bf0991bd9a9da1a8d44dd130c6508602215e50bb1e385326779d'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getJxmcUrlData(url, name) {
|
|
||||||
if (typeof URL !== "undefined") {
|
|
||||||
let urls = new URL(url);
|
|
||||||
let data = urls.searchParams.get(name);
|
|
||||||
return data ? data : '';
|
|
||||||
} else {
|
|
||||||
const query = url.match(/\?.*/)[0].substring(1)
|
|
||||||
const vars = query.split('&')
|
|
||||||
for (let i = 0; i < vars.length; i++) {
|
|
||||||
const pair = vars[i].split('=')
|
|
||||||
if (pair[0] === name) {
|
|
||||||
return vars[i].substr(vars[i].indexOf('=') + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function api(fn, stk, params) {
|
|
||||||
let url = `https://m.jingxi.com/pgcenter`;
|
|
||||||
url = await decrypturl(`${url}/${fn}?sceneval=2&_stk=active,activedesc,sceneval&_ste=1&_=${Date.now()}&sceneval=2`, stk, params, 10012)
|
|
||||||
let myRequest = taskUrl(url);
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
let rv = "";
|
|
||||||
$.get(myRequest, (err, resp, data) => {
|
|
||||||
try {
|
|
||||||
if (data) {
|
|
||||||
data = JSON.parse(data)
|
|
||||||
rv = data
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(data);
|
|
||||||
$.logErr(e, resp)
|
|
||||||
resolve();
|
|
||||||
} finally {
|
|
||||||
resolve(rv);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function taskUrl(url) {
|
|
||||||
return {
|
|
||||||
url,
|
|
||||||
headers: {
|
|
||||||
"Host": "m.jingxi.com",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
"User-Agent": "jdpingou",
|
|
||||||
"Accept": "*/*",
|
|
||||||
"Referer": "https://st.jingxi.com/pingou/taskcenter/index.html",
|
|
||||||
"Accept-Encoding": "gzip, deflate",
|
|
||||||
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
"Cookie": $.cookie,
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function randomWord(randomFlag, min, max) {
|
|
||||||
var str = "",
|
|
||||||
range = min,
|
|
||||||
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
|
|
||||||
|
|
||||||
// 随机产生
|
|
||||||
if (randomFlag) {
|
|
||||||
range = Math.round(Math.random() * (max - min)) + min;
|
|
||||||
}
|
|
||||||
for (var i = 0; i < range; i++) {
|
|
||||||
pos = Math.round(Math.random() * (arr.length - 1));
|
|
||||||
str += arr[pos];
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Date.prototype.Format = function (fmt) {
|
|
||||||
var e,
|
|
||||||
n = this,
|
|
||||||
d = fmt,
|
|
||||||
l = {
|
|
||||||
"M+": n.getMonth() + 1,
|
|
||||||
"d+": n.getDate(),
|
|
||||||
"D+": n.getDate(),
|
|
||||||
"h+": n.getHours(),
|
|
||||||
"H+": n.getHours(),
|
|
||||||
"m+": n.getMinutes(),
|
|
||||||
"s+": n.getSeconds(),
|
|
||||||
"w+": n.getDay(),
|
|
||||||
"q+": Math.floor((n.getMonth() + 3) / 3),
|
|
||||||
"S+": n.getMilliseconds()
|
|
||||||
};
|
|
||||||
/(y+)/i.test(d) && (d = d.replace(RegExp.$1, "".concat(n.getFullYear()).substr(4 - RegExp.$1.length)));
|
|
||||||
for (var k in l) {
|
|
||||||
if (new RegExp("(".concat(k, ")")).test(d)) {
|
|
||||||
var t, a = "S+" === k ? "000" : "00";
|
|
||||||
d = d.replace(RegExp.$1, 1 == RegExp.$1.length ? l[k] : ("".concat(a) + l[k]).substr("".concat(l[k]).length))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
|
||||||
}
|
|
293
jd_nzmh.js
293
jd_nzmh.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
333
jd_prodev.py
333
jd_prodev.py
@ -1,333 +0,0 @@
|
|||||||
# 邀好友赢大礼 create by doubi 通用模板
|
|
||||||
# 17:/椋东送福利,邀请好友,争排行榜排位,大礼送不停,(E1Y7RAtC4b) ,升级新版猄·=·Dσσōngαpρ
|
|
||||||
# https://prodev.m.jd.com/mall/active/dVF7gQUVKyUcuSsVhuya5d2XD4F/index.html?code=7cfd02e34d6d41028286d6a95cdeea7e&invitePin=jd_5a2bee883014b
|
|
||||||
# 注意事项 pin 为助力pin 必须保证ck在里面
|
|
||||||
# by 逗比 https://t.me/jdsign2
|
|
||||||
|
|
||||||
import json
|
|
||||||
import requests,random,time,asyncio,re,os
|
|
||||||
from urllib.parse import quote_plus,unquote_plus
|
|
||||||
from functools import partial
|
|
||||||
print = partial(print, flush=True)
|
|
||||||
|
|
||||||
activatyname = '邀请赢大礼'
|
|
||||||
activityId = 'dVF7gQUVKyUcuSsVhuya5d2XD4F' # 活动类型
|
|
||||||
authorCode = os.environ["prodev"] # 活动id
|
|
||||||
invitePin = os.environ["invitePin"] # pin 填写cookie后面的pin
|
|
||||||
activityUrl = f'https://prodev.m.jd.com/mall/active/{activityId}/index.html?code={authorCode}&invitePin={invitePin}'
|
|
||||||
|
|
||||||
# 随机ua
|
|
||||||
def randomuserAgent():
|
|
||||||
global uuid, addressid, iosVer, iosV, clientVersion, iPhone, area, ADID, lng, lat
|
|
||||||
uuid = ''.join(random.sample(
|
|
||||||
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
|
||||||
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'z'], 40))
|
|
||||||
addressid = ''.join(random.sample('1234567898647', 10))
|
|
||||||
iosVer = ''.join(random.sample(["15.1.1", "14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
|
|
||||||
iosV = iosVer.replace('.', '_')
|
|
||||||
clientVersion = ''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
|
|
||||||
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
|
|
||||||
area = ''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(
|
|
||||||
random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
|
|
||||||
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(
|
|
||||||
random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(
|
|
||||||
random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
|
|
||||||
lng = '119.31991256596' + str(random.randint(100, 999))
|
|
||||||
lat = '26.1187118976' + str(random.randint(100, 999))
|
|
||||||
UserAgent = ''
|
|
||||||
if not UserAgent:
|
|
||||||
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
|
|
||||||
else:
|
|
||||||
return UserAgent
|
|
||||||
|
|
||||||
# 检测ck状态
|
|
||||||
async def check(ua, ck):
|
|
||||||
try:
|
|
||||||
url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion'
|
|
||||||
header = {
|
|
||||||
"Host": "me-api.jd.com",
|
|
||||||
"Accept": "*/*",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
"Cookie": ck,
|
|
||||||
"User-Agent": ua,
|
|
||||||
"Accept-Language": "zh-cn",
|
|
||||||
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
|
||||||
"Accept-Encoding": "gzip, deflate",
|
|
||||||
}
|
|
||||||
result = requests.get(url=url, headers=header, timeout=2).text
|
|
||||||
codestate = json.loads(result)
|
|
||||||
if codestate['retcode'] == '1001':
|
|
||||||
msg = "当前ck已失效,请检查"
|
|
||||||
return {'code': 1001, 'data': msg}
|
|
||||||
elif codestate['retcode'] == '0' and 'userInfo' in codestate['data']:
|
|
||||||
nickName = codestate['data']['userInfo']['baseInfo']['nickname']
|
|
||||||
return {'code': 200, 'name': nickName, 'ck': ck}
|
|
||||||
except Exception as e:
|
|
||||||
return {'code': 0, 'data': e}
|
|
||||||
|
|
||||||
# 获取当前时间
|
|
||||||
def get_time():
|
|
||||||
time_now = round(time.time()*1000)
|
|
||||||
return time_now
|
|
||||||
|
|
||||||
# 登录plogin
|
|
||||||
async def plogin(ua,cookie):
|
|
||||||
now = get_time()
|
|
||||||
url = f'https://plogin.m.jd.com/cgi-bin/ml/islogin?time={now}&callback=__jsonp{now-2}&_={now+2}'
|
|
||||||
header = {
|
|
||||||
'Accept':'*/*',
|
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
|
||||||
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Host': 'plogin.m.jd.com',
|
|
||||||
'Referer': 'https://prodev.m.jd.com/',
|
|
||||||
'User-Agent':ua
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=header,timeout=5).text
|
|
||||||
return response
|
|
||||||
|
|
||||||
# 活动接口
|
|
||||||
async def jdjoy(ua,cookie):
|
|
||||||
|
|
||||||
url = f'https://jdjoy.jd.com/member/bring/getActivityPage?code={authorCode}&invitePin={invitePin}&_t={get_time()}'
|
|
||||||
header = {
|
|
||||||
'Accept':'*/*',
|
|
||||||
'Accept-Encoding':'gzip, deflate',
|
|
||||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Content-Type':'application/json',
|
|
||||||
'Cookie':cookie,
|
|
||||||
"Host":'jdjoy.jd.com',
|
|
||||||
'Origin':'https://prodev.m.jd.com',
|
|
||||||
"Referer":'https://prodev.m.jd.com/',
|
|
||||||
'User-Agent':ua
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=header).text
|
|
||||||
return json.loads(response)
|
|
||||||
|
|
||||||
# go开卡
|
|
||||||
async def ruhui(ua,cookie):
|
|
||||||
url = f'https://jdjoy.jd.com/member/bring/joinMember?code={authorCode}&invitePin={invitePin}'
|
|
||||||
header = {
|
|
||||||
'Host': 'jdjoy.jd.com',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Origin': 'https://prodev.m.jd.com',
|
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
|
||||||
'Cookie': cookie,
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Accept': '*/*',
|
|
||||||
'User-Agent': ua,
|
|
||||||
'Referer': activityUrl,
|
|
||||||
'Accept-Language': 'zh-cn',
|
|
||||||
'request-from': 'native'
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=header).text
|
|
||||||
return json.loads(response)
|
|
||||||
|
|
||||||
# 检查开卡状态
|
|
||||||
async def check_ruhui(body,cookie,venderId,ua):
|
|
||||||
url = f'https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=getShopOpenCardInfo&body={json.dumps(body)}&client=H5&clientVersion=9.2.0&uuid=88888'
|
|
||||||
headers = {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Accept': '*/*',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Cookie': cookie,
|
|
||||||
'User-Agent': ua,
|
|
||||||
'Accept-Language': 'zh-cn',
|
|
||||||
'Referer': f'https://shopmember.m.jd.com/shopcard/?venderId={venderId}&channel=801&returnUrl={json.dumps(activityUrl)}',
|
|
||||||
'Accept-Encoding': 'gzip, deflate'
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=headers,timeout=5).text
|
|
||||||
return json.loads(response)
|
|
||||||
|
|
||||||
# 领取奖励
|
|
||||||
async def getInviteReward(cookie,ua,number):
|
|
||||||
url = f'https://jdjoy.jd.com/member/bring/getInviteReward?code={authorCode}&stage={number}'
|
|
||||||
header = {
|
|
||||||
'Accept':'*/*',
|
|
||||||
'Accept-Encoding':'gzip, deflate',
|
|
||||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Content-Type':'application/json',
|
|
||||||
'Cookie':cookie,
|
|
||||||
"Host":'jdjoy.jd.com',
|
|
||||||
'Origin':'https://prodev.m.jd.com',
|
|
||||||
"Referer":'https://prodev.m.jd.com/',
|
|
||||||
'User-Agent':ua
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=header).text
|
|
||||||
return json.loads(response)
|
|
||||||
|
|
||||||
# 开启活动
|
|
||||||
async def firstInvite(cookie,ua):
|
|
||||||
url = f'https://jdjoy.jd.com/member/bring/firstInvite?code={authorCode}'
|
|
||||||
header = {
|
|
||||||
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
||||||
'Accept-Encoding':'gzip, deflate',
|
|
||||||
'Accept-Language':'zh-Hans-US;q=1,en-US;q=0.9',
|
|
||||||
'Connection':'keep-alive',
|
|
||||||
'Cookie':cookie,
|
|
||||||
"Host":'jdjoy.jd.com',
|
|
||||||
'User-Agent':ua
|
|
||||||
}
|
|
||||||
response = requests.get(url=url,headers=header).text
|
|
||||||
print(response)
|
|
||||||
return json.loads(response)
|
|
||||||
|
|
||||||
async def get_ck(data):
|
|
||||||
cklist = []
|
|
||||||
if data['code']!=200:
|
|
||||||
return {'code': 0, 'data':data}
|
|
||||||
else:
|
|
||||||
env_data = data['data']
|
|
||||||
for ck in env_data:
|
|
||||||
if 'remarks' in ck and ck['name']=='JD_COOKIE':
|
|
||||||
cklist.append(ck['value'])
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
return cklist
|
|
||||||
|
|
||||||
|
|
||||||
# 检查pin
|
|
||||||
def checkpin(cks:list,pin):
|
|
||||||
for ck in cks:
|
|
||||||
if pin in ck:
|
|
||||||
return ck
|
|
||||||
else:
|
|
||||||
None
|
|
||||||
|
|
||||||
# 主程序
|
|
||||||
async def main():
|
|
||||||
try:
|
|
||||||
cks = os.environ["JD_COOKIE"].split("&")
|
|
||||||
except:
|
|
||||||
with open('cklist1.txt','r') as f:
|
|
||||||
cks = f.read().split('\n')
|
|
||||||
success = 0 # 计算成功数
|
|
||||||
inveteck = checkpin(cks,invitePin) # 根据设定的pin返回对应ck
|
|
||||||
needinviteNum = [] # 需要助力次数
|
|
||||||
needdel = []
|
|
||||||
need = []
|
|
||||||
if inveteck:
|
|
||||||
print(f'🔔{activatyname}', flush=True)
|
|
||||||
print(f'==================共{len(cks)}个京东账号Cookie==================')
|
|
||||||
print(f'==================脚本执行- 北京时间(UTC+8):{get_time()}=====================\n')
|
|
||||||
print(f'您好!{invitePin},正在获取您的活动信息',)
|
|
||||||
ua = randomuserAgent() # 获取ua
|
|
||||||
result = await check(ua, inveteck) # 检测ck
|
|
||||||
if result['code'] == 200:
|
|
||||||
await plogin(ua,inveteck) # 获取登录状态
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
result = await jdjoy(ua,inveteck) # 获取活动信息
|
|
||||||
await firstInvite(inveteck,ua) # 开启活动
|
|
||||||
if result['success']:
|
|
||||||
brandName = result['data']['brandName'] # 店铺名字
|
|
||||||
venderId = result['data']['venderId'] # 店铺入会id
|
|
||||||
rewardslist =[] # 奖品
|
|
||||||
successCount = result['data']['successCount'] # 当前成功数
|
|
||||||
success += successCount
|
|
||||||
result_data = result['data']['rewards'] # 奖品数据
|
|
||||||
print(f'您好!账号[{invitePin}],开启{brandName}邀请好友活动\n去开活动')
|
|
||||||
for i in result_data:
|
|
||||||
stage = i['stage']
|
|
||||||
inviteNum = i['inviteNum'] # 单次需要拉新人数
|
|
||||||
need.append(inviteNum)
|
|
||||||
rewardName = i['rewardName'] # 奖品名
|
|
||||||
rewardNum = i['rewardStock']
|
|
||||||
if rewardNum !=0:
|
|
||||||
needinviteNum.append(inviteNum)
|
|
||||||
needdel.append(inviteNum)
|
|
||||||
rewardslist.append(f'级别{stage}: 需助力{inviteNum}人,奖品: {rewardName},库存:{rewardNum}件\n')
|
|
||||||
if len(rewardslist)!=0:
|
|
||||||
print('当前活动奖品如下: \n'+str('\n'.join(rewardslist))+f'\n当前已助力{successCount}次\n')
|
|
||||||
for nmubers in needdel:
|
|
||||||
if success >= nmubers:
|
|
||||||
print("您当前助力已经满足了,可以去领奖励了")
|
|
||||||
print(f'\n这就去领取奖励{need.index(nmubers)+1}')
|
|
||||||
result = await getInviteReward(inveteck,ua,need.index(nmubers)+1)
|
|
||||||
print(result)
|
|
||||||
needinviteNum.remove(nmubers)
|
|
||||||
await asyncio.sleep(10)
|
|
||||||
needdel = needinviteNum
|
|
||||||
if needinviteNum == []:
|
|
||||||
print('奖励已经全部获取啦,退出程序')
|
|
||||||
return
|
|
||||||
for n,ck in enumerate(cks,1):
|
|
||||||
ua = randomuserAgent() # 获取ua
|
|
||||||
try:
|
|
||||||
pin = re.findall(r'(pt_pin=([^; ]+)(?=;))',str(ck))[0]
|
|
||||||
pin = (unquote_plus(pin[1]))
|
|
||||||
except IndexError:
|
|
||||||
pin = f'用户{n}'
|
|
||||||
print(f'******开始【京东账号{n}】{pin} *********\n')
|
|
||||||
for n,nmubers in enumerate(needinviteNum,1):
|
|
||||||
for nmubers in needdel:
|
|
||||||
if success >= nmubers:
|
|
||||||
print(nmubers)
|
|
||||||
print("您当前助力已经满足了,可以去领奖励了")
|
|
||||||
print(f'\n这就去领取奖励{need.index(nmubers)+1}')
|
|
||||||
result = await getInviteReward(inveteck,ua,need.index(nmubers)+1)
|
|
||||||
print(result)
|
|
||||||
needinviteNum.remove(nmubers)
|
|
||||||
await asyncio.sleep(10)
|
|
||||||
needdel = needinviteNum
|
|
||||||
if needinviteNum == []:
|
|
||||||
print('奖励已经全部获取啦,退出程序')
|
|
||||||
return
|
|
||||||
await plogin(ua,ck) # 获取登录状态
|
|
||||||
result = await check(ua, ck) # 检测ck
|
|
||||||
if result['code'] == 200:
|
|
||||||
result = await jdjoy(ua,ck) # 调用ck
|
|
||||||
if result['success']:
|
|
||||||
print(f'账户[{pin}]已开启{brandName}邀请好友活动\n')
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
result= await check_ruhui({"venderId":str(venderId), "channel": "401" },ck,venderId,ua) # 检查入会状态
|
|
||||||
try:
|
|
||||||
if result['result']['userInfo']['openCardStatus']==0: # 0 未开卡
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
print(f'您还不是会员哦,这就去去助力{invitePin}\n')
|
|
||||||
result = await ruhui(ua,ck)
|
|
||||||
if result['success']:
|
|
||||||
success +=1
|
|
||||||
print(f'助力成功! 当前成功助力{success}个\n')
|
|
||||||
if '交易失败' in str(result):
|
|
||||||
success +=1
|
|
||||||
print(f'助力成功! 当前成功助力{success}个\n')
|
|
||||||
else:
|
|
||||||
print(result)
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
else:
|
|
||||||
print('您已经是会员啦,不去请求了入会了\n')
|
|
||||||
continue
|
|
||||||
|
|
||||||
except TypeError as e:
|
|
||||||
print(e)
|
|
||||||
result = await ruhui(ua,ck)
|
|
||||||
if result['success']:
|
|
||||||
success +=1
|
|
||||||
print(f'助力成功! 当前成功助力{success}个\n')
|
|
||||||
if '交易失败' in result:
|
|
||||||
success +=1
|
|
||||||
print(f'助力成功! 当前成功助力{success}个\n')
|
|
||||||
else:
|
|
||||||
print(result['errorMessage'])
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
|
|
||||||
else: # 没有获取到活动信息
|
|
||||||
print('未获取到活动参数信息\n')
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print(result['data'])
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
print('未能获取到活动信息\n')
|
|
||||||
return
|
|
||||||
|
|
||||||
else:
|
|
||||||
print(result['data'])
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
print(f'pin填写有误,请重试')
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(main())
|
|
File diff suppressed because one or more lines are too long
@ -1,59 +0,0 @@
|
|||||||
import {JDHelloWorld, User} from "./TS_JDHelloWorld";
|
|
||||||
|
|
||||||
class Jd_queryRedpacket extends JDHelloWorld {
|
|
||||||
constructor() {
|
|
||||||
super("京东红包");
|
|
||||||
}
|
|
||||||
|
|
||||||
async init() {
|
|
||||||
await this.run(new Jd_queryRedpacket())
|
|
||||||
}
|
|
||||||
|
|
||||||
add(arg1: number, arg2: number) {
|
|
||||||
let r1, r2, m
|
|
||||||
try {
|
|
||||||
r1 = arg1.toString().split('.')[1].length
|
|
||||||
} catch (e) {
|
|
||||||
r1 = 0
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
r2 = arg2.toString().split('.')[1].length
|
|
||||||
} catch (e) {
|
|
||||||
r2 = 0
|
|
||||||
}
|
|
||||||
m = Math.pow(10, Math.max(r1, r2))
|
|
||||||
return parseFloat(((arg1 * m + arg2 * m) / m).toFixed(2))
|
|
||||||
}
|
|
||||||
|
|
||||||
async main(user: User) {
|
|
||||||
let res: any = await this.get(`https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${Date.now()}&sceneval=2&g_login_type=1&g_ty=ls`, {
|
|
||||||
'Host': 'm.jingxi.com',
|
|
||||||
'Referer': 'https://st.jingxi.com/my/redpacket.shtml',
|
|
||||||
"Cookie": user.cookie,
|
|
||||||
'User-Agent': user.UserAgent
|
|
||||||
})
|
|
||||||
let day: number = new Date().getDay(), jdRed: number = 0, jdRedExp: number = 0, jsRed: number = 0, jsRedExp: number = 0
|
|
||||||
for (let j of res.data.useRedInfo?.redList || []) {
|
|
||||||
console.log(j)
|
|
||||||
if (j.orgLimitStr.includes('京喜')) {
|
|
||||||
} else if (j.activityName.includes('极速版')) {
|
|
||||||
jsRed += j.balance
|
|
||||||
if (new Date(j.endTime * 1000).getDay() === day)
|
|
||||||
jsRedExp = this.add(jsRedExp, j.balance)
|
|
||||||
} else if (j.orgLimitStr.includes('京东健康')) {
|
|
||||||
} else {
|
|
||||||
jdRed = this.add(jdRed, j.balance)
|
|
||||||
if (new Date(j.endTime * 1000).getDay() === day)
|
|
||||||
jdRedExp = this.add(jdRedExp, j.balance)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log('京东', jdRed, ' 今日过期:', jdRedExp)
|
|
||||||
console.log('极速', jsRed, ' 今日过期:', jsRedExp)
|
|
||||||
let msg = `【账号】 ${user.UserName}\n京东红包 ${jdRed}\n今日过期 ${jdRedExp}\n\n`
|
|
||||||
return {
|
|
||||||
msg: msg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new Jd_queryRedpacket().init().then()
|
|
310
jd_redrain.js
310
jd_redrain.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
@ -1,159 +0,0 @@
|
|||||||
/**
|
|
||||||
* 极速版-挖宝
|
|
||||||
* 助力,挖宝,任务,提现
|
|
||||||
* cron: 2 0,1,18 * * *
|
|
||||||
* CK1 HW.ts -> 内部
|
|
||||||
* CK2~n 内部 -> HW.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {get, getshareCodeHW, o2s, randomString, requireConfig, wait} from './TS_USER_AGENTS'
|
|
||||||
import {H5ST} from "./utils/h5st";
|
|
||||||
|
|
||||||
let cookie: string = '', res: any = '', UserName: string, data: any, h5stTool: any = new H5ST("ce6c2", "jdltapp;", "9929056438203725")
|
|
||||||
|
|
||||||
interface INVITE {
|
|
||||||
inviter: string,
|
|
||||||
inviteCode: string
|
|
||||||
}
|
|
||||||
|
|
||||||
let shareCodes: INVITE[] = [], shareCodesHW = [], shareCodesSelf: INVITE[] = []
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
let cookiesArr: string[] = await requireConfig()
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
try {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
|
|
||||||
await h5stTool.__genAlgo()
|
|
||||||
res = await api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
|
|
||||||
console.log('助力码', res.data.markedPin, res.data.inviteCode)
|
|
||||||
shareCodesSelf.push({inviter: res.data.markedPin, inviteCode: res.data.inviteCode})
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error')
|
|
||||||
}
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
console.log('内部助力')
|
|
||||||
o2s(shareCodesSelf)
|
|
||||||
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
try {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
|
|
||||||
await h5stTool.__genAlgo()
|
|
||||||
if (shareCodesHW.length === 0) {
|
|
||||||
shareCodesHW = await getshareCodeHW('fcwb')
|
|
||||||
}
|
|
||||||
if (index === 0 && cookiesArr.length === 1) {
|
|
||||||
shareCodes = Array.from(new Set([...shareCodesHW, ...shareCodesSelf]))
|
|
||||||
} else {
|
|
||||||
shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let code of shareCodesSelf) {
|
|
||||||
console.log(`去助力 ${code.inviteCode}`)
|
|
||||||
res = await api('happyDigHelp', {"linkId": "pTTvJeSTrpthgk9ASBVGsw", "inviter": code.inviter, "inviteCode": code.inviteCode})
|
|
||||||
if (res.code === 0) {
|
|
||||||
console.log('助力成功')
|
|
||||||
await wait(2000)
|
|
||||||
break
|
|
||||||
} else if (res.code === 16143) {
|
|
||||||
console.log('已助力')
|
|
||||||
} else if (res.code === 16144) {
|
|
||||||
console.log('上限')
|
|
||||||
await wait(2000)
|
|
||||||
break
|
|
||||||
} else {
|
|
||||||
o2s(res)
|
|
||||||
}
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
res = await api('apTaskList', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
|
|
||||||
await wait(1000)
|
|
||||||
|
|
||||||
for (let t of res.data) {
|
|
||||||
if (t.taskType === 'BROWSE_CHANNEL' && t.taskDoTimes === 0 && t.taskLimitTimes === 1) {
|
|
||||||
console.log(t.taskShowTitle)
|
|
||||||
data = await api('apDoTask', {"linkId": "pTTvJeSTrpthgk9ASBVGsw", "taskType": "BROWSE_CHANNEL", "taskId": t.id, "channel": 4, "itemId": encodeURIComponent(t.taskSourceUrl), "checkVersion": false})
|
|
||||||
await wait(1000)
|
|
||||||
if (data.success) {
|
|
||||||
console.log('任务完成')
|
|
||||||
} else {
|
|
||||||
o2s(data, '任务失败')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error', e)
|
|
||||||
await wait(2000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let [index, value] of cookiesArr.entries()) {
|
|
||||||
cookie = value
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`\n开始【京东账号${index + 1}】${UserName}\n`)
|
|
||||||
|
|
||||||
await h5stTool.__genAlgo()
|
|
||||||
res = await api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
|
|
||||||
let blood: number = res.data.blood
|
|
||||||
for (let i = 0; i < 4; i++) {
|
|
||||||
try {
|
|
||||||
if (blood <= 1) {
|
|
||||||
console.log('能量剩余1,跳过 A')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
for (let j = 0; j < 4; j++) {
|
|
||||||
if (blood <= 1) {
|
|
||||||
console.log('能量剩余1,跳过 B')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
res = await api('happyDigDo', {"round": 1, "rowIdx": i, "colIdx": j, "linkId": "pTTvJeSTrpthgk9ASBVGsw"})
|
|
||||||
o2s(res)
|
|
||||||
|
|
||||||
if (res.data.chunk.type === 1) {
|
|
||||||
console.log('挖到👎')
|
|
||||||
} else if (res.data.chunk.type === 2) {
|
|
||||||
console.log('挖到🧧', parseFloat(res.data.chunk.value))
|
|
||||||
} else if (res.data.chunk.type === 4) {
|
|
||||||
console.log('挖到💣')
|
|
||||||
}
|
|
||||||
await wait(1000)
|
|
||||||
res = await api('happyDigHome', {"linkId": "pTTvJeSTrpthgk9ASBVGsw"})
|
|
||||||
if (res.data.blood === 1) {
|
|
||||||
blood = 1
|
|
||||||
console.log('能量剩余1,退出')
|
|
||||||
break
|
|
||||||
}
|
|
||||||
await wait(4000)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error', res?.errMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
|
|
||||||
async function api(fn: string, body: object) {
|
|
||||||
let timestamp: number = Date.now()
|
|
||||||
let h5st: string = h5stTool.__genH5st({
|
|
||||||
appid: 'activities_platform',
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
client: 'H5',
|
|
||||||
clientVersion: '1.0.0',
|
|
||||||
functionId: fn,
|
|
||||||
t: timestamp.toString(),
|
|
||||||
})
|
|
||||||
return await get(`https://api.m.jd.com/?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&t=${timestamp}&appid=activities_platform&client=H5&clientVersion=1.0.0&h5st=${h5st}`, {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'Origin': 'https://bnzf.jd.com',
|
|
||||||
'User-Agent': `jdapp;iPhone;10.2.2;14.3;${randomString(40)};M/5.0;network/wifi;ADID/;model/iPhone12,1;addressid/4199175193;appBuild/167863;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;`,
|
|
||||||
'Referer': 'https://bnzf.jd.com/',
|
|
||||||
'Cookie': cookie
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
import axios from 'axios'
|
|
||||||
import {sendNotify} from './sendNotify';
|
|
||||||
import {requireConfig} from './TS_USER_AGENTS'
|
|
||||||
|
|
||||||
const CryptoJS = require('crypto-js');
|
|
||||||
let cookie: string = '', UserName: string
|
|
||||||
|
|
||||||
!(async () => {
|
|
||||||
let cookiesArr: string[] = await requireConfig()
|
|
||||||
cookie = cookiesArr[Math.random() * cookiesArr.length | 0]
|
|
||||||
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
|
|
||||||
console.log(`<Start> ${UserName}\n`)
|
|
||||||
|
|
||||||
let t: number = Date.now(), fn: string = 'MyAssetsService.execute', body: object = {"method": "goldShopPage", "data": {"channel": 1}}
|
|
||||||
let params: string = `lite-android&${JSON.stringify(body)}&android&3.1.0&${fn}&${t}&846c4c32dae910ef`
|
|
||||||
let key = CryptoJS.HmacSHA256(params, '12aea658f76e453faf803d15c40a72e0').toString()
|
|
||||||
|
|
||||||
let {data} = await axios.get(`https://api.m.jd.com/api?functionId=${fn}&body=${encodeURIComponent(JSON.stringify(body))}&appid=lite-android&client=android&uuid=846c4c32dae910ef&clientVersion=3.1.0&t=${t}&sign=${key}`, {
|
|
||||||
headers: {
|
|
||||||
'Host': 'api.m.jd.com',
|
|
||||||
'accept': '*/*',
|
|
||||||
'kernelplatform': 'RN',
|
|
||||||
'user-agent': 'JDMobileLite/3.1.0 (iPad; iOS 14.4; Scale/2.00)',
|
|
||||||
'accept-language': 'zh-Hans-CN;q=1, ja-CN;q=0.9',
|
|
||||||
'Cookie': cookie
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
for (let t of data.data.gears) {
|
|
||||||
console.log(t.amount)
|
|
||||||
if (t.amount === '50' || t.amount === '10') {
|
|
||||||
await sendNotify('极速版金币', `${t.amount}🧧`)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})()
|
|
File diff suppressed because one or more lines are too long
416
jd_sxLottery.js
416
jd_sxLottery.js
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user