2 Star 1 Fork 27

kevin/jd_scripts

forked from XanderYe/jd_scripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
jd_bean_sign.ts 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2021-11-23 10:04 . edit
import axios from "axios";
import {readFileSync, writeFileSync, unlinkSync} from "fs";
import {execSync} from "child_process";
import {requireConfig} from "./TS_USER_AGENTS";
let notify = require('./sendNotify'), message: string = '';
async function main() {
let cookiesArr: any = await requireConfig();
let cookiesNobyDa: {
cookie: string
}[] = []
for (let i = 0; i < cookiesArr.length; i++) {
cookiesNobyDa.push({cookie: cookiesArr[i]})
}
let data: any = '';
try {
data = await axios.get('https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js', {timeout: 5000})
data = data.data
console.log('raw')
} catch (e) {
try {
data = await axios.get('https://ghproxy.com/https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js', {timeout: 10000})
data = data.data
console.log('ghproxy')
} catch (e) {
data = '非脚本问题!网络错误,访问github失败'
}
}
if (data.indexOf('京东多合一签到脚本') > -1) {
data = data.replace('var OtherKey = ``;', `var OtherKey = \`${JSON.stringify(cookiesNobyDa)}\`;`)
data = data.replace(/ztmFUCxcPMNyUq0P/g, 'q8DNJdpcfRQ69gIx')
writeFileSync('./sign.js', data, 'utf-8')
execSync('node ./sign.js >> ./sign.log')
data = readFileSync('./sign.log', 'utf-8')
data = data.match(/【.*/gm)
message += data.join('\n').replace(/红包/g, '红包\n\n')
unlinkSync('./sign.js')
unlinkSync('./sign.log')
}
await notify.sendNotify('京东多合一签到脚本 via NobyDa@Github', message)
}
main().then()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kevin0217/jd_scripts.git
git@gitee.com:kevin0217/jd_scripts.git
kevin0217
jd_scripts
jd_scripts
master

搜索帮助