mirror of
https://github.com/shufflewzc/faker3.git
synced 2026-04-04 00:44:07 +08:00
sync
This commit is contained in:
141
jd_live.js
141
jd_live.js
@@ -3,31 +3,21 @@
|
||||
活动结束时间未知
|
||||
活动入口:京东APP首页-京东直播
|
||||
地址:https://h5.m.jd.com/babelDiy/Zeus/2zwQnu4WHRNfqMSdv69UPgpZMnE2/index.html/
|
||||
已支持IOS双京东账号,Node.js支持N个京东账号
|
||||
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#京东直播
|
||||
50 12-14 * * * https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_live.js, tag=京东直播, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "50 12-14 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_live.js,tag=京东直播
|
||||
|
||||
===============Surge=================
|
||||
京东直播 = type=cron,cronexp="50 12-14 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_live.js
|
||||
|
||||
============小火箭=========
|
||||
京东直播 = type=cron,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_live.js, cronexpr="50 12-14 * * *", timeout=3600, enable=true
|
||||
随机定时跑一次 或者自行定时
|
||||
5 12
|
||||
*/
|
||||
|
||||
const $ = new Env('京东直播');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||
|
||||
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||
let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
|
||||
//IOS等用户直接用NobyDa的jd cookie
|
||||
|
||||
let cookiesArr = [], cookie = '', message;
|
||||
let uuid
|
||||
let jdPandaToken = '';
|
||||
jdPandaToken = $.isNode() ? (process.env.PandaToken ? process.env.PandaToken : `${jdPandaToken}`) : ($.getdata('PandaToken') ? $.getdata('PandaToken') : `${jdPandaToken}`);
|
||||
|
||||
if ($.isNode()) {
|
||||
Object.keys(jdCookieNode).forEach((item) => {
|
||||
cookiesArr.push(jdCookieNode[item])
|
||||
@@ -42,6 +32,10 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
|
||||
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||
return;
|
||||
}
|
||||
if (!jdPandaToken) {
|
||||
console.log('请填写Panda获取的Token,变量是PandaToken');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < cookiesArr.length; i++) {
|
||||
if (cookiesArr[i]) {
|
||||
cookie = cookiesArr[i];
|
||||
@@ -50,18 +44,11 @@ const JD_API_HOST = 'https://api.m.jd.com/api';
|
||||
$.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
|
||||
}
|
||||
uuid = randomString(40)
|
||||
|
||||
console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
|
||||
await jdHealth()
|
||||
await $.wait(15000)
|
||||
}
|
||||
}
|
||||
})()
|
||||
@@ -117,10 +104,14 @@ function getTaskList() {
|
||||
}
|
||||
console.log(`去做分享直播间任务`)
|
||||
await shareTask()
|
||||
await $.wait(1500);
|
||||
await awardTask()
|
||||
await $.wait(1500);
|
||||
console.log(`去做浏览直播间任务`)
|
||||
await viewTask()
|
||||
await $.wait(1500);
|
||||
await awardTask("commonViewTask")
|
||||
await $.wait(1500);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -134,10 +125,13 @@ function getTaskList() {
|
||||
|
||||
async function getauthorId(liveId) {
|
||||
let functionId = `liveDetailV910`
|
||||
let body = {"liveId":liveId,"fromId":"","liveList":[],"sku":"","source":"17","d":"","direction":"","isNeedVideo":1}
|
||||
let sign = await getSign(functionId, body)
|
||||
let body = encodeURIComponent(JSON.stringify({"liveId":liveId,"fromId":"","liveList":[],"sku":"","source":"17","d":"","direction":"","isNeedVideo":1}))
|
||||
let uuid = randomString(16)
|
||||
// let sign = await getSign(functionId, decodeURIComponent(body), uuid)
|
||||
let sign = await getSignfromPanda(functionId, body)
|
||||
let url = `https://api.m.jd.com/client.action?functionId=${functionId}&build=167774&client=apple&clientVersion=10.1.0&uuid=${uuid}&${sign}`
|
||||
return new Promise(resolve => {
|
||||
$.post(taskPostUrl(functionId, sign), async (err, resp, data) => {
|
||||
$.post(taskPostUrl(functionId, body, url), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@@ -158,10 +152,13 @@ async function getauthorId(liveId) {
|
||||
|
||||
async function superTask(liveId, authorId) {
|
||||
let functionId = `liveChannelReportDataV912`
|
||||
let body = {"liveId":liveId,"type":"viewTask","authorId":authorId,"extra":{"time":60}}
|
||||
let sign = await getSign(functionId, body)
|
||||
let body = encodeURIComponent(JSON.stringify({"liveId":liveId,"type":"viewTask","authorId":authorId,"extra":{"time":60}}))
|
||||
let uuid = randomString(16)
|
||||
// let sign = await getSign(functionId, decodeURIComponent(body), uuid)
|
||||
let sign = await getSignfromPanda(functionId, body)
|
||||
let url = `https://api.m.jd.com/client.action?functionId=${functionId}&build=167774&client=apple&clientVersion=10.1.0&uuid=${uuid}&${sign}`
|
||||
return new Promise(resolve => {
|
||||
$.post(taskPostUrl(functionId, sign), async (err, resp, data) => {
|
||||
$.post(taskPostUrl(functionId, body, url), async (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@@ -250,6 +247,7 @@ function awardTask(type="shareTask", liveId = '2942545') {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function sign() {
|
||||
return new Promise(resolve => {
|
||||
$.get(taskUrl("getChannelTaskRewardToM", {"type":"signTask","itemId":"1"}), async (err, resp, data) => {
|
||||
@@ -278,16 +276,22 @@ function sign() {
|
||||
})
|
||||
}
|
||||
|
||||
function getSign(functionId, body) {
|
||||
function getSign(functionid, body, uuid) {
|
||||
return new Promise(async resolve => {
|
||||
let data = {
|
||||
functionId,
|
||||
body: JSON.stringify(body),
|
||||
client: "apple",
|
||||
clientVersion: "10.3.0"
|
||||
"functionId":functionid,
|
||||
"body":body,
|
||||
"uuid":uuid,
|
||||
"client":"apple",
|
||||
"clientVersion":"10.1.0"
|
||||
}
|
||||
let Host = ""
|
||||
let HostArr = ['jdsign.cf', 'signer.nz.lu']
|
||||
let Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
||||
if (process.env.SIGN_URL) {
|
||||
Host = process.env.SIGN_URL
|
||||
} else {
|
||||
Host = HostArr[Math.floor((Math.random() * HostArr.length))]
|
||||
}
|
||||
let options = {
|
||||
url: `https://cdn.nz.lu/ddo`,
|
||||
body: JSON.stringify(data),
|
||||
@@ -295,7 +299,7 @@ function getSign(functionId, body) {
|
||||
Host,
|
||||
"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"
|
||||
},
|
||||
timeout: 30 * 1000
|
||||
timeout: 15000
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
@@ -314,10 +318,12 @@ function getSign(functionId, body) {
|
||||
})
|
||||
}
|
||||
|
||||
function taskPostUrl(function_id, body = "") {
|
||||
function taskPostUrl(function_id, body = {}, url=null) {
|
||||
if (url && (function_id === "liveChannelReportDataV912" || function_id === "liveDetailV910")) body = `body=${body}`
|
||||
if(!url) url = `https://api.m.jd.com/client.action?functionId=${function_id}`
|
||||
return {
|
||||
url: `https://api.m.jd.com/client.action?functionId=${function_id}`,
|
||||
body,
|
||||
url: url,
|
||||
body: body,
|
||||
headers: {
|
||||
"Host": "api.m.jd.com",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
@@ -325,7 +331,8 @@ function taskPostUrl(function_id, body = "") {
|
||||
"Referer": "",
|
||||
"Cookie": cookie,
|
||||
"Origin": "https://h5.m.jd.com",
|
||||
"Content-Type": 'application/x-www-form-urlencoded',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
"Content-Length": "996",
|
||||
"User-Agent": "JD4iPhone/167774 (iPhone; iOS 14.7.1; Scale/3.00)",
|
||||
"Accept-Language": "zh-Hans-CN;q=1",
|
||||
"Accept-Encoding": "gzip, deflate, br"
|
||||
@@ -360,50 +367,6 @@ function randomString(e) {
|
||||
return n
|
||||
}
|
||||
|
||||
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 safeGet(data) {
|
||||
try {
|
||||
if (typeof JSON.parse(data) == "object") {
|
||||
|
||||
Reference in New Issue
Block a user