mirror of
https://github.com/okyyds/yyds.git
synced 2026-07-13 22:11:18 +08:00
update
This commit is contained in:
@@ -8,15 +8,15 @@ Last Modified time: 2021-05-19 16:27:18
|
||||
================QuantumultX==================
|
||||
[task_local]
|
||||
#京东全民开红包
|
||||
1 0,10 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_redPacket.js, tag=京东全民开红包, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png, enabled=true
|
||||
1 0,10 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_redPacket.js, tag=京东全民开红包, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png, enabled=true
|
||||
===================Loon==============
|
||||
[Script]
|
||||
cron "1 0,10 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_redPacket.js, tag=京东全民开红包
|
||||
cron "1 0,10 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_redPacket.js, tag=京东全民开红包
|
||||
===============Surge===============
|
||||
[Script]
|
||||
京东全民开红包 = type=cron,cronexp="1 0,10 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_redPacket.js
|
||||
京东全民开红包 = type=cron,cronexp="1 0,10 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_redPacket.js
|
||||
====================================小火箭=============================
|
||||
京东全民开红包 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_redPacket.js, cronexpr="1 0,10 * * *", timeout=3600, enable=true
|
||||
京东全民开红包 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_redPacket.js, cronexpr="1 0,10 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('京东全民开红包内部助力');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
|
||||
2252
jd_cfd_hb.js
Normal file
2252
jd_cfd_hb.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,17 +8,17 @@
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#京喜财富岛合成珍珠
|
||||
30 0-23/2 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_cfd_pearl.js, tag=京喜财富岛合成珍珠, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxcfd.png, enabled=true
|
||||
30 0-23/2 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_cfd_pearl.js, tag=京喜财富岛合成珍珠, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxcfd.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "30 0-23/2 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_cfd_pearl.js,tag=京喜财富岛合成珍珠
|
||||
cron "30 0-23/2 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_cfd_pearl.js,tag=京喜财富岛合成珍珠
|
||||
|
||||
===============Surge=================
|
||||
京喜财富岛合成珍珠 = type=cron,cronexp="30 0-23/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_cfd_pearl.js
|
||||
京喜财富岛合成珍珠 = type=cron,cronexp="30 0-23/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_cfd_pearl.js
|
||||
|
||||
============小火箭=========
|
||||
京喜财富岛合成珍珠 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_cfd_pearl.js, cronexpr="30 0-23/2 * * *", timeout=3600, enable=true
|
||||
京喜财富岛合成珍珠 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_cfd_pearl.js, cronexpr="30 0-23/2 * * *", timeout=3600, enable=true
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ by:jiulan
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#京东评价
|
||||
37 15 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_evaluation.js, tag=京东评价, enabled=true
|
||||
37 15 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_evaluation.js, tag=京东评价, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "37 15 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_evaluation.js,tag=京东评价
|
||||
cron "37 15 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_evaluation.js,tag=京东评价
|
||||
|
||||
===============Surge=================
|
||||
京东评价 = type=cron,cronexp="37 15 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_evaluation.js
|
||||
京东评价 = type=cron,cronexp="37 15 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_evaluation.js
|
||||
|
||||
============小火箭=========
|
||||
京东评价 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_evaluation.js, cronexpr="37 15 * * *", timeout=3600, enable=true
|
||||
京东评价 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_evaluation.js, cronexpr="37 15 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('京东评价');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#发财挖宝
|
||||
40 6,17 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_fcwb.js, tag=发财挖宝, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
|
||||
40 6,17 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_fcwb.js, tag=发财挖宝, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "40 6,17 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_fcwb.js,tag=发财挖宝
|
||||
cron "40 6,17 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_fcwb.js,tag=发财挖宝
|
||||
|
||||
===============Surge=================
|
||||
发财挖宝 = type=cron,cronexp="40 6,17 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_fcwb.js
|
||||
发财挖宝 = type=cron,cronexp="40 6,17 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_fcwb.js
|
||||
|
||||
============小火箭=========
|
||||
发财挖宝 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_fcwb.js, cronexpr="40 6,17 * * *", timeout=3600, enable=true
|
||||
发财挖宝 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_fcwb.js, cronexpr="40 6,17 * * *", timeout=3600, enable=true
|
||||
|
||||
* * */
|
||||
const $ = new Env('发财挖宝');
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
===================quantumultx================
|
||||
[task_local]
|
||||
#东东健康社区
|
||||
5 4,14 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_health_help.js, tag=东东健康社区, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
5 4,14 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_health_help.js, tag=东东健康社区, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
=====================Loon================
|
||||
[Script]
|
||||
cron "5 4,14 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_health_help.js, tag=东东健康社区
|
||||
cron "5 4,14 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_health_help.js, tag=东东健康社区
|
||||
|
||||
====================Surge================
|
||||
东东健康社区 = type=cron,cronexp="5 4,14 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_health_help.js
|
||||
东东健康社区 = type=cron,cronexp="5 4,14 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_health_help.js
|
||||
|
||||
============小火箭=========
|
||||
东东健康社区 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_health_help.js, cronexpr="5 4,14 * * *", timeout=3600, enable=true
|
||||
东东健康社区 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_health_help.js, cronexpr="5 4,14 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env("东东健康社区内部互助");
|
||||
const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
=================================Quantumultx=========================
|
||||
[task_local]
|
||||
#京东特价翻翻乐
|
||||
20 0-23/3 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdtj_winner.js, tag=京东特价翻翻乐, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
|
||||
20 0-23/3 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_jdtj_winner.js, tag=京东特价翻翻乐, img-url=https://github.com/58xinian/icon/raw/master/jdgc.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "20 0-23/3 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdtj_winner.js,tag=京东特价翻翻乐
|
||||
cron "20 0-23/3 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_jdtj_winner.js,tag=京东特价翻翻乐
|
||||
|
||||
===============Surge=================
|
||||
京东特价翻翻乐 = type=cron,cronexp="20 0-23/3 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdtj_winner.js
|
||||
京东特价翻翻乐 = type=cron,cronexp="20 0-23/3 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_jdtj_winner.js
|
||||
|
||||
============小火箭=========
|
||||
京东特价翻翻乐 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_jdtj_winner.js, cronexpr="20 0-23/3 * * *", timeout=3600, enable=true
|
||||
京东特价翻翻乐 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_jdtj_winner.js, cronexpr="20 0-23/3 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('京东特价翻翻乐');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
|
||||
@@ -7,17 +7,17 @@ by:小手冰凉 tg:@chianPLA
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#京东小魔方--收集兑换
|
||||
31 8 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mofang_ex.js, tag=京东小魔方--收集兑换, enabled=true
|
||||
31 8 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mofang_ex.js, tag=京东小魔方--收集兑换, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "31 8 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mofang_ex.js,tag=京东小魔方--收集兑换
|
||||
cron "31 8 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mofang_ex.js,tag=京东小魔方--收集兑换
|
||||
|
||||
===============Surge=================
|
||||
京东小魔方--收集兑换 = type=cron,cronexp="31 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mofang_ex.js
|
||||
京东小魔方--收集兑换 = type=cron,cronexp="31 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mofang_ex.js
|
||||
|
||||
============小火箭=========
|
||||
京东小魔方--收集兑换 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mofang_ex.js, cronexpr="31 8 * * *", timeout=3600, enable=true
|
||||
京东小魔方--收集兑换 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mofang_ex.js, cronexpr="31 8 * * *", timeout=3600, enable=true
|
||||
|
||||
*/
|
||||
const $ = new Env('京东小魔方--收集兑换');
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
=================================Quantumultx=========================
|
||||
[task_local]
|
||||
#5G超级盲盒
|
||||
5 0,19 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mohe_help.js, tag=5G超级盲盒, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
5 0,19 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mohe_help.js, tag=5G超级盲盒, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
=================================Loon===================================
|
||||
[Script]
|
||||
cron "5 0,19 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mohe_help.js,tag=5G超级盲盒
|
||||
cron "5 0,19 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mohe_help.js,tag=5G超级盲盒
|
||||
|
||||
===================================Surge================================
|
||||
5G超级盲盒 = type=cron,cronexp="5 0,19 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mohe_help.js
|
||||
5G超级盲盒 = type=cron,cronexp="5 0,19 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mohe_help.js
|
||||
|
||||
====================================小火箭=============================
|
||||
5G超级盲盒 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_mohe_help.js, cronexpr="5 0,19 * * *", timeout=3600, enable=true
|
||||
5G超级盲盒 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_mohe_help.js, cronexpr="5 0,19 * * *", timeout=3600, enable=true
|
||||
*/
|
||||
const $ = new Env('5G超级盲盒内部互助');
|
||||
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||
|
||||
@@ -6,17 +6,17 @@ JoyJd任务脚本
|
||||
============Quantumultx===============
|
||||
[task_local]
|
||||
#JoyJd任务脚本
|
||||
5 2,18 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_joyjd_open.js, tag=JoyJd任务脚本, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
5 2,18 * * * https://raw.githubusercontent.com/okyyds/yydspure/master/jd_joyjd_open.js, tag=JoyJd任务脚本, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
|
||||
|
||||
================Loon==============
|
||||
[Script]
|
||||
cron "5 2,18 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_joyjd_open.js,tag=JoyJd任务脚本
|
||||
cron "5 2,18 * * *" script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_joyjd_open.js,tag=JoyJd任务脚本
|
||||
|
||||
===============Surge=================
|
||||
JoyJd任务脚本 = type=cron,cronexp="5 2,18 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_joyjd_open.js
|
||||
JoyJd任务脚本 = type=cron,cronexp="5 2,18 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_joyjd_open.js
|
||||
|
||||
============小火箭=========
|
||||
JoyJd任务脚本 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_joyjd_open.js, cronexpr="5 2,18 * * *", timeout=3600, enable=true
|
||||
JoyJd任务脚本 = type=cron,script-path=https://raw.githubusercontent.com/okyyds/yydspure/master/jd_joyjd_open.js, cronexpr="5 2,18 * * *", timeout=3600, enable=true
|
||||
|
||||
|
||||
*/
|
||||
|
||||
121
jd_try.js
121
jd_try.js
@@ -8,6 +8,18 @@
|
||||
*
|
||||
* @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js
|
||||
* @LastEditors: X1a0He
|
||||
参考环境变量配置如下:
|
||||
export JD_TRY="true"
|
||||
export JD_TRY_PLOG="true" #是否打印输出到日志
|
||||
export JD_TRY_PASSZC="true" #过滤种草官类试用
|
||||
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度
|
||||
export JD_TRY_APPLYINTERVAL="5000" #商品试用之间和获取商品之间的间隔
|
||||
export JD_TRY_APPLYNUMFILTER="100000" #过滤大于设定值的已申请人数
|
||||
export JD_TRY_MINSUPPLYNUM="1" #最小提供数量
|
||||
export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知,不需要可以不用设置
|
||||
export JD_TRY_UNIFIED="false" 默认采用不同试用组
|
||||
cron "4 1-22/8 * * *" jd_try.js, tag:京东试用
|
||||
|
||||
*/
|
||||
const $ = new Env('京东试用')
|
||||
const URL = 'https://api.m.jd.com/client.action'
|
||||
@@ -36,10 +48,24 @@ $.innerKeyWords =
|
||||
"女用", "神油", "足力健", "老年", "老人",
|
||||
"宠物", "饲料", "丝袜", "黑丝", "磨脚",
|
||||
"脚皮", "除臭", "性感", "内裤", "跳蛋",
|
||||
"安全套", "龟头", "阴道", "阴部"
|
||||
"安全套", "龟头", "阴道", "阴部", "手机卡",
|
||||
"流量卡", "和田玉", "钢化膜", "手机壳","习题","试卷"
|
||||
]
|
||||
//下面很重要,遇到问题请把下面注释看一遍再来问
|
||||
let args_xh = {
|
||||
/*
|
||||
* 控制是否输出当前环境变量设置,默认为false
|
||||
* 环境变量名称:XH_TRY_ENV
|
||||
*/
|
||||
env: process.env.XH_TRY_ENV === 'true' || false,
|
||||
/*
|
||||
* 跳过某个指定账号,默认为全部账号清空
|
||||
* 填写规则:例如当前Cookie1为pt_key=key; pt_pin=pin1;则环境变量填写pin1即可,此时pin1的购物车将不会被清空
|
||||
* 若有更多,则按照pin1@pin2@pin3进行填写
|
||||
* 环境变量名称:XH_TRY_EXCEPT
|
||||
*/
|
||||
except: process.env.XH_TRY_EXCEPT && process.env.XH_TRY_EXCEPT.split('@') || [],
|
||||
//以上环境变量新增于2022.01.30
|
||||
/*
|
||||
* 每个Tab页要便遍历的申请页数,由于京东试用又改了,获取不到每一个Tab页的总页数了(显示null),所以特定增加一个环境变了以控制申请页数
|
||||
* 例如设置 JD_TRY_PRICE 为 30,假如现在正在遍历tab1,那tab1就会被遍历到30页,到31页就会跳到tab2,或下一个预设的tab页继续遍历到30页
|
||||
@@ -56,7 +82,7 @@ let args_xh = {
|
||||
* 提示:想每个账号独立不同的试用产品的,请设置为false,想减少脚本运行时间的,请设置为true
|
||||
* 默认为false
|
||||
*/
|
||||
unified: process.env.JD_TRY_UNIFIED || false,
|
||||
unified: process.env.JD_TRY_UNIFIED === 'true' || false,
|
||||
//以上环境变量新增于2022.01.25
|
||||
/*
|
||||
* 商品原价,低于这个价格都不会试用,意思是
|
||||
@@ -100,7 +126,7 @@ let args_xh = {
|
||||
* 过滤大于设定值的已申请人数,例如下面设置的1000,A商品已经有1001人申请了,则A商品不会进行申请,会被跳过
|
||||
* 可设置环境变量:JD_TRY_APPLYNUMFILTER
|
||||
* */
|
||||
applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER * 1 || 10000,
|
||||
applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER * 1 || 100000,
|
||||
/*
|
||||
* 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒)
|
||||
* 可设置环境变量:JD_TRY_APPLYINTERVAL
|
||||
@@ -121,7 +147,7 @@ let args_xh = {
|
||||
* 例如B商品是种草官专属试用商品,下面设置为true,即使你是种草官账号,A商品也不会被添加到待提交试用组
|
||||
* 可设置环境变量:JD_TRY_PASSZC,默认为true
|
||||
* */
|
||||
passZhongCao: process.env.JD_TRY_PASSZC || true,
|
||||
passZhongCao: process.env.JD_TRY_PASSZC === 'true' || true,
|
||||
/*
|
||||
* 是否打印输出到日志,考虑到如果试用组长度过大,例如100以上,如果每个商品检测都打印一遍,日志长度会非常长
|
||||
* 打印的优点:清晰知道每个商品为什么会被过滤,哪个商品被添加到了待提交试用组
|
||||
@@ -131,13 +157,13 @@ let args_xh = {
|
||||
* 不打印的缺点:无法清晰知道每个商品为什么会被过滤,哪个商品被添加到了待提交试用组
|
||||
* 可设置环境变量:JD_TRY_PLOG,默认为true
|
||||
* */
|
||||
printLog: process.env.JD_TRY_PLOG || true,
|
||||
printLog: process.env.JD_TRY_PLOG === 'true' || true,
|
||||
/*
|
||||
* 白名单,是否打开,如果下面为true,那么黑名单会自动失效
|
||||
* 白名单和黑名单无法共存,白名单永远优先于黑名单
|
||||
* 可通过环境变量控制:JD_TRY_WHITELIST,默认为false
|
||||
* */
|
||||
whiteList: process.env.JD_TRY_WHITELIST || false,
|
||||
whiteList: process.env.JD_TRY_WHITELIST === 'true' || false,
|
||||
/*
|
||||
* 白名单关键词,当标题存在关键词时,加入到试用组
|
||||
* 例如A商品的名字为『旺仔牛奶48瓶特价』,白名单其中一个关键词是『牛奶』,那么A将会直接被添加到待提交试用组,不再进行另外判断
|
||||
@@ -152,10 +178,7 @@ let args_xh = {
|
||||
sendNum: process.env.JD_TRY_SENDNUM * 1 || 4,
|
||||
}
|
||||
//上面很重要,遇到问题请把上面注释看一遍再来问
|
||||
!(async () => {
|
||||
console.log('X1a0He留:遇到问题请把脚本内的注释看一遍再来问,谢谢')
|
||||
console.log('X1a0He留:遇到问题请把脚本内的注释看一遍再来问,谢谢')
|
||||
console.log('X1a0He留:遇到问题请把脚本内的注释看一遍再来问,谢谢')
|
||||
!(async() => {
|
||||
await $.wait(500)
|
||||
// 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true
|
||||
if (process.env.JD_TRY && process.env.JD_TRY === 'true') {
|
||||
@@ -175,7 +198,13 @@ let args_xh = {
|
||||
$.nickName = '';
|
||||
await totalBean();
|
||||
console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
|
||||
if (!$.isLogin) {
|
||||
$.except = false;
|
||||
if(args_xh.except.includes($.UserName)){
|
||||
console.log(`跳过账号:${$.nickName || $.UserName}`)
|
||||
$.except = true;
|
||||
continue
|
||||
}
|
||||
if(!$.isLogin){
|
||||
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
|
||||
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
|
||||
});
|
||||
@@ -199,6 +228,7 @@ let args_xh = {
|
||||
$.wrong = false
|
||||
size = 1
|
||||
while(trialActivityIdList.length < args_xh.maxLength && $.isForbidden === false){
|
||||
if(args_xh.unified && trialActivityIdList.length !== 0) break;
|
||||
if($.nowTabIdIndex === args_xh.tabId.length){
|
||||
console.log(`tabId组已遍历完毕,不在获取商品\n`);
|
||||
break;
|
||||
@@ -242,7 +272,7 @@ let args_xh = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if($.isNode()){
|
||||
if($.isNode() && $.except === false){
|
||||
if(($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum){
|
||||
console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`)
|
||||
await $.notify.sendNotify(`${$.name}`, `${notifyMsg}`)
|
||||
@@ -273,32 +303,28 @@ function requireConfig() {
|
||||
//IOS等用户直接用NobyDa的jd $.cookie
|
||||
$.cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||
}
|
||||
if (typeof process.env.JD_TRY_WHITELIST === "undefined") args_xh.whiteList = false;
|
||||
else args_xh.whiteList = process.env.JD_TRY_WHITELIST === 'true';
|
||||
if (typeof process.env.JD_TRY_PLOG === "undefined") args_xh.printLog = true;
|
||||
else args_xh.printLog = process.env.JD_TRY_PLOG === 'true';
|
||||
if (typeof process.env.JD_TRY_UNIFIED === "undefined") args_xh.unified = false;
|
||||
else args_xh.unified = process.env.JD_TRY_UNIFIED === 'true';
|
||||
if (typeof process.env.JD_TRY_PASSZC === "undefined") args_xh.passZhongCao = true;
|
||||
else args_xh.passZhongCao = process.env.JD_TRY_PASSZC === 'true';
|
||||
for (let keyWord of $.innerKeyWords) args_xh.titleFilters.push(keyWord)
|
||||
for(let keyWord of $.innerKeyWords) args_xh.titleFilters.push(keyWord)
|
||||
console.log(`共${$.cookiesArr.length}个京东账号\n`)
|
||||
console.log('=====环境变量配置如下=====')
|
||||
console.log(`totalPages: ${typeof args_xh.totalPages}, ${args_xh.totalPages}`)
|
||||
console.log(`unified: ${typeof args_xh.unified}, ${args_xh.unified}`)
|
||||
console.log(`jdPrice: ${typeof args_xh.jdPrice}, ${args_xh.jdPrice}`)
|
||||
console.log(`tabId: ${typeof args_xh.tabId}, ${args_xh.tabId}`)
|
||||
console.log(`titleFilters: ${typeof args_xh.titleFilters}, ${args_xh.titleFilters}`)
|
||||
console.log(`trialPrice: ${typeof args_xh.trialPrice}, ${args_xh.trialPrice}`)
|
||||
console.log(`minSupplyNum: ${typeof args_xh.minSupplyNum}, ${args_xh.minSupplyNum}`)
|
||||
console.log(`applyNumFilter: ${typeof args_xh.applyNumFilter}, ${args_xh.applyNumFilter}`)
|
||||
console.log(`applyInterval: ${typeof args_xh.applyInterval}, ${args_xh.applyInterval}`)
|
||||
console.log(`maxLength: ${typeof args_xh.maxLength}, ${args_xh.maxLength}`)
|
||||
console.log(`passZhongCao: ${typeof args_xh.passZhongCao}, ${args_xh.passZhongCao}`)
|
||||
console.log(`printLog: ${typeof args_xh.printLog}, ${args_xh.printLog}`)
|
||||
console.log(`whiteList: ${typeof args_xh.whiteList}, ${args_xh.whiteList}`)
|
||||
console.log(`whiteListKeywords: ${typeof args_xh.whiteListKeywords}, ${args_xh.whiteListKeywords}`)
|
||||
console.log('=======================')
|
||||
if(args_xh.env){
|
||||
console.log('=====环境变量配置如下=====')
|
||||
console.log(`env: ${typeof args_xh.env}, ${args_xh.env}`)
|
||||
console.log(`except: ${typeof args_xh.except}, ${args_xh.except}`)
|
||||
console.log(`totalPages: ${typeof args_xh.totalPages}, ${args_xh.totalPages}`)
|
||||
console.log(`unified: ${typeof args_xh.unified}, ${args_xh.unified}`)
|
||||
console.log(`jdPrice: ${typeof args_xh.jdPrice}, ${args_xh.jdPrice}`)
|
||||
console.log(`tabId: ${typeof args_xh.tabId}, ${args_xh.tabId}`)
|
||||
console.log(`titleFilters: ${typeof args_xh.titleFilters}, ${args_xh.titleFilters}`)
|
||||
console.log(`trialPrice: ${typeof args_xh.trialPrice}, ${args_xh.trialPrice}`)
|
||||
console.log(`minSupplyNum: ${typeof args_xh.minSupplyNum}, ${args_xh.minSupplyNum}`)
|
||||
console.log(`applyNumFilter: ${typeof args_xh.applyNumFilter}, ${args_xh.applyNumFilter}`)
|
||||
console.log(`applyInterval: ${typeof args_xh.applyInterval}, ${args_xh.applyInterval}`)
|
||||
console.log(`maxLength: ${typeof args_xh.maxLength}, ${args_xh.maxLength}`)
|
||||
console.log(`passZhongCao: ${typeof args_xh.passZhongCao}, ${args_xh.passZhongCao}`)
|
||||
console.log(`printLog: ${typeof args_xh.printLog}, ${args_xh.printLog}`)
|
||||
console.log(`whiteList: ${typeof args_xh.whiteList}, ${args_xh.whiteList}`)
|
||||
console.log(`whiteListKeywords: ${typeof args_xh.whiteListKeywords}, ${args_xh.whiteListKeywords}`)
|
||||
console.log('=======================')
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
@@ -313,9 +339,9 @@ function try_tabList() {
|
||||
});
|
||||
let option = taskurl_xh('newtry', 'try_tabList', body)
|
||||
$.get(option, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) {
|
||||
try{
|
||||
if(err){
|
||||
if(JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`){
|
||||
$.isForbidden = true
|
||||
console.log('账号被京东服务器风控,不再请求该帐号')
|
||||
} else {
|
||||
@@ -352,9 +378,9 @@ function try_feedsList(tabId, page) {
|
||||
});
|
||||
let option = taskurl_xh('newtry', 'try_feedsList', body)
|
||||
$.get(option, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) {
|
||||
try{
|
||||
if(err){
|
||||
if(JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`){
|
||||
$.isForbidden = true
|
||||
console.log('账号被京东服务器风控,不再请求该帐号')
|
||||
} else {
|
||||
@@ -393,8 +419,7 @@ function try_feedsList(tabId, page) {
|
||||
args_xh.printLog ? console.log('商品被过滤,该商品是种草官专属') : ''
|
||||
$.isPush = false;
|
||||
break;
|
||||
}
|
||||
else if (itemTag.tagType === 5) {
|
||||
} else if(itemTag.tagType === 5){
|
||||
args_xh.printLog ? console.log('商品被跳过,该商品是付费试用!') : ''
|
||||
$.isPush = false;
|
||||
break;
|
||||
@@ -465,9 +490,9 @@ function try_apply(title, activityId) {
|
||||
});
|
||||
let option = taskurl_xh('newtry', 'try_apply', body)
|
||||
$.get(option, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) {
|
||||
try{
|
||||
if(err){
|
||||
if(JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`){
|
||||
$.isForbidden = true
|
||||
console.log('账号被京东服务器风控,不再请求该帐号')
|
||||
} else {
|
||||
|
||||
474
jd_wskey.py
Normal file
474
jd_wskey.py
Normal file
@@ -0,0 +1,474 @@
|
||||
# -*- coding: utf-8 -*
|
||||
'''
|
||||
new Env('wskey转换');
|
||||
'''
|
||||
import socket
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import time
|
||||
|
||||
if "WSKEY_DEBUG" in os.environ:
|
||||
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.debug("\nDEBUG模式开启!\n")
|
||||
else:
|
||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import requests
|
||||
except Exception as e:
|
||||
logger.info(str(e) + "\n缺少requests模块, 请执行命令:pip3 install requests\n")
|
||||
sys.exit(1)
|
||||
os.environ['no_proxy'] = '*'
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
try:
|
||||
from notify import send
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("无推送文件")
|
||||
|
||||
ver = 20203
|
||||
|
||||
|
||||
# 登录青龙 返回值 token
|
||||
def get_qltoken(username, password):
|
||||
logger.info("Token失效, 新登陆\n")
|
||||
url = "http://127.0.0.1:{0}/api/user/login".format(port)
|
||||
payload = {
|
||||
'username': username,
|
||||
'password': password
|
||||
}
|
||||
payload = json.dumps(payload)
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
try:
|
||||
res = requests.post(url=url, headers=headers, data=payload)
|
||||
token = json.loads(res.text)["data"]['token']
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("青龙登录失败, 请检查面板状态!")
|
||||
text = '青龙面板WSKEY转换登陆面板失败, 请检查面板状态.'
|
||||
try:
|
||||
send('WSKEY转换', text)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("通知发送失败")
|
||||
sys.exit(1)
|
||||
else:
|
||||
return token
|
||||
|
||||
|
||||
# 返回值 Token
|
||||
def ql_login():
|
||||
path = '/ql/config/auth.json'
|
||||
if os.path.isfile(path):
|
||||
with open(path, "r") as file:
|
||||
auth = file.read()
|
||||
file.close()
|
||||
auth = json.loads(auth)
|
||||
username = auth["username"]
|
||||
password = auth["password"]
|
||||
token = auth["token"]
|
||||
if token == '':
|
||||
return get_qltoken(username, password)
|
||||
else:
|
||||
url = "http://127.0.0.1:{0}/api/user".format(port)
|
||||
headers = {
|
||||
'Authorization': 'Bearer {0}'.format(token),
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38'
|
||||
}
|
||||
res = requests.get(url=url, headers=headers)
|
||||
if res.status_code == 200:
|
||||
return token
|
||||
else:
|
||||
return get_qltoken(username, password)
|
||||
else:
|
||||
logger.info("没有发现auth文件, 你这是青龙吗???")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# 返回值 list[wskey]
|
||||
def get_wskey():
|
||||
if "JD_WSCK" in os.environ:
|
||||
wskey_list = os.environ['JD_WSCK'].split('&')
|
||||
if len(wskey_list) > 0:
|
||||
return wskey_list
|
||||
else:
|
||||
logger.info("JD_WSCK变量未启用")
|
||||
sys.exit(1)
|
||||
else:
|
||||
logger.info("未添加JD_WSCK变量")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# 返回值 list[jd_cookie]
|
||||
def get_ck():
|
||||
if "JD_COOKIE" in os.environ:
|
||||
ck_list = os.environ['JD_COOKIE'].split('&')
|
||||
if len(ck_list) > 0:
|
||||
return ck_list
|
||||
else:
|
||||
logger.info("JD_COOKIE变量未启用")
|
||||
sys.exit(1)
|
||||
else:
|
||||
logger.info("未添加JD_COOKIE变量")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# 返回值 bool
|
||||
def check_ck(ck):
|
||||
if "QL_WSCK" in os.environ:
|
||||
logger.info("不检查账号有效性\n--------------------\n")
|
||||
return False
|
||||
else:
|
||||
url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion'
|
||||
headers = {
|
||||
'Cookie': ck,
|
||||
'Referer': 'https://home.m.jd.com/myJd/home.action',
|
||||
'user-agent': ua
|
||||
}
|
||||
try:
|
||||
res = requests.get(url=url, headers=headers, verify=False, timeout=10)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("JD接口错误 请重试或者更换IP")
|
||||
return False
|
||||
else:
|
||||
if res.status_code == 200:
|
||||
code = int(json.loads(res.text)['retcode'])
|
||||
pin = ck.split(";")[1]
|
||||
if code == 0:
|
||||
logger.info(str(pin) + ";状态正常\n")
|
||||
return True
|
||||
else:
|
||||
logger.info(str(pin) + ";状态失效\n")
|
||||
return False
|
||||
else:
|
||||
logger.info("JD接口错误码: " + str(res.status_code))
|
||||
return False
|
||||
|
||||
|
||||
# 返回值 bool jd_ck
|
||||
def getToken(wskey):
|
||||
try:
|
||||
url = str(base64.b64decode(url_t).decode()) + 'genToken'
|
||||
header = {"User-Agent": ua}
|
||||
params = requests.get(url=url, headers=header, verify=False, timeout=20).json()
|
||||
except Exception as err:
|
||||
logger.info("Params参数获取失败")
|
||||
logger.debug(str(err))
|
||||
return False, wskey
|
||||
headers = {
|
||||
'cookie': wskey,
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'charset': 'UTF-8',
|
||||
'accept-encoding': 'br,gzip,deflate',
|
||||
'user-agent': ua
|
||||
}
|
||||
url = 'https://api.m.jd.com/client.action'
|
||||
data = 'body=%7B%22to%22%3A%22https%253a%252f%252fplogin.m.jd.com%252fjd-mlogin%252fstatic%252fhtml%252fappjmp_blank.html%22%7D&'
|
||||
try:
|
||||
res = requests.post(url=url, params=params, headers=headers, data=data, verify=False, timeout=10)
|
||||
res_json = json.loads(res.text)
|
||||
tokenKey = res_json['tokenKey']
|
||||
except Exception as err:
|
||||
logger.info("JD_WSKEY接口抛出错误 尝试重试 更换IP")
|
||||
logger.info(str(err))
|
||||
return False, wskey
|
||||
else:
|
||||
return appjmp(wskey, tokenKey)
|
||||
|
||||
|
||||
# 返回值 bool jd_ck
|
||||
def appjmp(wskey, tokenKey):
|
||||
wskey = "pt_" + str(wskey.split(";")[0])
|
||||
if tokenKey == 'xxx':
|
||||
logger.info(str(wskey) + ";WsKey状态失效\n--------------------\n")
|
||||
return False, wskey
|
||||
headers = {
|
||||
'User-Agent': ua,
|
||||
'accept': 'accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
|
||||
'x-requested-with': 'com.jingdong.app.mall'
|
||||
}
|
||||
params = {
|
||||
'tokenKey': tokenKey,
|
||||
'to': 'https://plogin.m.jd.com/jd-mlogin/static/html/appjmp_blank.html',
|
||||
}
|
||||
url = 'https://un.m.jd.com/cgi-bin/app/appjmp'
|
||||
try:
|
||||
res = requests.get(url=url, headers=headers, params=params, verify=False, allow_redirects=False, timeout=20)
|
||||
except Exception as err:
|
||||
logger.info("JD_appjmp 接口错误 请重试或者更换IP\n")
|
||||
logger.info(str(err))
|
||||
return False, wskey
|
||||
else:
|
||||
try:
|
||||
res_set = res.cookies.get_dict()
|
||||
pt_key = 'pt_key=' + res_set['pt_key']
|
||||
pt_pin = 'pt_pin=' + res_set['pt_pin']
|
||||
jd_ck = str(pt_key) + ';' + str(pt_pin) + ';'
|
||||
except Exception as err:
|
||||
logger.info("JD_appjmp提取Cookie错误 请重试或者更换IP\n")
|
||||
logger.info(str(err))
|
||||
return False, wskey
|
||||
else:
|
||||
if 'fake' in pt_key:
|
||||
logger.info(str(wskey) + ";WsKey状态失效\n")
|
||||
return False, wskey
|
||||
else:
|
||||
logger.info(str(wskey) + ";WsKey状态正常\n")
|
||||
return True, jd_ck
|
||||
|
||||
|
||||
def update():
|
||||
up_ver = int(cloud_arg['update'])
|
||||
if ver >= up_ver:
|
||||
logger.info("当前脚本版本: " + str(ver))
|
||||
logger.info("--------------------\n")
|
||||
else:
|
||||
logger.info("当前脚本版本: " + str(ver) + "新版本: " + str(up_ver))
|
||||
logger.info("存在新版本, 请更新脚本后执行")
|
||||
logger.info("--------------------\n")
|
||||
text = '当前脚本版本: {0}新版本: {1}, 请更新脚本~!'.format(ver, up_ver)
|
||||
try:
|
||||
send('WSKEY转换', text)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("通知发送失败")
|
||||
# sys.exit(0)
|
||||
|
||||
|
||||
def ql_check(port):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(2)
|
||||
try:
|
||||
sock.connect(('127.0.0.1', port))
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
sock.close()
|
||||
return False
|
||||
else:
|
||||
sock.close()
|
||||
return True
|
||||
|
||||
|
||||
def serch_ck(pin):
|
||||
for i in range(len(envlist)):
|
||||
if "name" not in envlist[i] or envlist[i]["name"] != "JD_COOKIE":
|
||||
continue
|
||||
if pin in envlist[i]['value']:
|
||||
value = envlist[i]['value']
|
||||
id = envlist[i][ql_id]
|
||||
logger.info(str(pin) + "检索成功\n")
|
||||
return True, value, id
|
||||
else:
|
||||
continue
|
||||
logger.info(str(pin) + "检索失败\n")
|
||||
return False, 1
|
||||
|
||||
|
||||
def get_env():
|
||||
url = 'http://127.0.0.1:{0}/api/envs'.format(port)
|
||||
try:
|
||||
res = s.get(url)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("\n青龙环境接口错误")
|
||||
sys.exit(1)
|
||||
else:
|
||||
data = json.loads(res.text)['data']
|
||||
return data
|
||||
|
||||
|
||||
def check_id():
|
||||
url = 'http://127.0.0.1:{0}/api/envs'.format(port)
|
||||
try:
|
||||
res = s.get(url).json()
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("\n青龙环境接口错误")
|
||||
sys.exit(1)
|
||||
else:
|
||||
if '_id' in res['data'][0]:
|
||||
logger.info("使用 _id 键值")
|
||||
return '_id'
|
||||
else:
|
||||
logger.info("使用 id 键值")
|
||||
return 'id'
|
||||
|
||||
|
||||
def ql_update(e_id, n_ck):
|
||||
url = 'http://127.0.0.1:{0}/api/envs'.format(port)
|
||||
data = {
|
||||
"name": "JD_COOKIE",
|
||||
"value": n_ck,
|
||||
ql_id: e_id
|
||||
}
|
||||
data = json.dumps(data)
|
||||
s.put(url=url, data=data)
|
||||
ql_enable(eid)
|
||||
|
||||
|
||||
def ql_enable(e_id):
|
||||
url = 'http://127.0.0.1:{0}/api/envs/enable'.format(port)
|
||||
data = '["{0}"]'.format(e_id)
|
||||
res = json.loads(s.put(url=url, data=data).text)
|
||||
if res['code'] == 200:
|
||||
logger.info("\n账号启用\n--------------------\n")
|
||||
return True
|
||||
else:
|
||||
logger.info("\n账号启用失败\n--------------------\n")
|
||||
return False
|
||||
|
||||
|
||||
def ql_disable(e_id):
|
||||
url = 'http://127.0.0.1:{0}/api/envs/disable'.format(port)
|
||||
data = '["{0}"]'.format(e_id)
|
||||
res = json.loads(s.put(url=url, data=data).text)
|
||||
if res['code'] == 200:
|
||||
logger.info("\n账号禁用成功\n--------------------\n")
|
||||
return True
|
||||
else:
|
||||
logger.info("\n账号禁用失败\n--------------------\n")
|
||||
return False
|
||||
|
||||
|
||||
def ql_insert(i_ck):
|
||||
data = [{"value": i_ck, "name": "JD_COOKIE"}]
|
||||
data = json.dumps(data)
|
||||
url = 'http://127.0.0.1:{0}/api/envs'.format(port)
|
||||
s.post(url=url, data=data)
|
||||
logger.info("\n账号添加完成\n--------------------\n")
|
||||
|
||||
|
||||
def cloud_info():
|
||||
url = str(base64.b64decode(url_t).decode()) + 'check_api'
|
||||
for i in range(3):
|
||||
try:
|
||||
headers = {"authorization": "Bearer Shizuku"}
|
||||
res = requests.get(url=url, verify=False, headers=headers, timeout=20).text
|
||||
except requests.exceptions.ConnectTimeout:
|
||||
logger.info("\n获取云端参数超时, 正在重试!" + str(i))
|
||||
time.sleep(1)
|
||||
continue
|
||||
except requests.exceptions.ReadTimeout:
|
||||
logger.info("\n获取云端参数超时, 正在重试!" + str(i))
|
||||
time.sleep(1)
|
||||
continue
|
||||
except Exception as err:
|
||||
logger.info("\n未知错误云端, 退出脚本!")
|
||||
logger.debug(str(err))
|
||||
sys.exit(1)
|
||||
else:
|
||||
try:
|
||||
c_info = json.loads(res)
|
||||
except Exception as err:
|
||||
logger.info("云端参数解析失败")
|
||||
logger.debug(str(err))
|
||||
sys.exit(1)
|
||||
else:
|
||||
return c_info
|
||||
|
||||
|
||||
def check_cloud():
|
||||
url_list = ['aHR0cDovLzQzLjEzNS45MC4yMy8=', 'aHR0cHM6Ly9zaGl6dWt1Lm1sLw==', 'aHR0cHM6Ly9jZi5zaGl6dWt1Lm1sLw==']
|
||||
for i in url_list:
|
||||
url = str(base64.b64decode(i).decode())
|
||||
try:
|
||||
requests.get(url=url, verify=False, timeout=10)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
continue
|
||||
else:
|
||||
info = ['Default', 'HTTPS', 'CloudFlare']
|
||||
logger.info(str(info[url_list.index(i)]) + " Server Check OK\n--------------------\n")
|
||||
return i
|
||||
logger.info("\n云端地址全部失效, 请检查网络!")
|
||||
try:
|
||||
send('WSKEY转换', '云端地址失效. 请检查网络.')
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("通知发送失败")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger.info("\n--------------------\n")
|
||||
if "QL_PORT" in os.environ:
|
||||
try:
|
||||
port = int(os.environ['QL_PORT'])
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("变量格式有问题...\n格式: export QL_PORT=\"端口号\"")
|
||||
logger.info("使用默认端口5700")
|
||||
port = 5700
|
||||
else:
|
||||
port = 5700
|
||||
if not ql_check(port):
|
||||
logger.info(str(port) + "端口检查失败, 如果改过端口, 请在变量中声明端口 \n在config.sh中加入 export QL_PORT=\"端口号\"")
|
||||
logger.info("\n如果你很确定端口没错, 还是无法执行, 在GitHub给我发issus\n--------------------\n")
|
||||
sys.exit(1)
|
||||
else:
|
||||
logger.info(str(port) + "端口检查通过")
|
||||
token = ql_login() # 获取青龙 token
|
||||
s = requests.session()
|
||||
s.headers.update({"authorization": "Bearer " + str(token)})
|
||||
s.headers.update({"Content-Type": "application/json;charset=UTF-8"})
|
||||
ql_id = check_id()
|
||||
url_t = check_cloud()
|
||||
cloud_arg = cloud_info()
|
||||
update()
|
||||
ua = cloud_arg['User-Agent']
|
||||
wslist = get_wskey()
|
||||
envlist = get_env()
|
||||
for ws in wslist:
|
||||
wspin = ws.split(";")[0]
|
||||
if "pin" in wspin:
|
||||
wspin = "pt_" + wspin + ";" # 封闭变量
|
||||
return_serch = serch_ck(wspin) # 变量 pt_pin 搜索获取 key eid
|
||||
if return_serch[0]: # bool: True 搜索到账号
|
||||
jck = str(return_serch[1]) # 拿到 JD_COOKIE
|
||||
if not check_ck(jck): # bool: False 判定 JD_COOKIE 有效性
|
||||
return_ws = getToken(ws) # 使用 WSKEY 请求获取 JD_COOKIE bool jd_ck
|
||||
if return_ws[0]: # bool: True
|
||||
nt_key = str(return_ws[1])
|
||||
# logger.info("wskey转pt_key成功", nt_key)
|
||||
logger.info("wskey转换成功")
|
||||
eid = return_serch[2] # 从 return_serch 拿到 eid
|
||||
ql_update(eid, nt_key) # 函数 ql_update 参数 eid JD_COOKIE
|
||||
else:
|
||||
if "WSKEY_AUTO_DISABLE" in os.environ: # 从系统变量中获取 WSKEY_AUTO_DISABLE
|
||||
logger.info(str(wspin) + "账号失效")
|
||||
text = "账号: {0} WsKey失效".format(wspin)
|
||||
else:
|
||||
eid = return_serch[2]
|
||||
logger.info(str(wspin) + "账号禁用")
|
||||
ql_disable(eid)
|
||||
text = "账号: {0} WsKey失效, 已禁用Cookie".format(wspin)
|
||||
try:
|
||||
send('WsKey转换脚本', text)
|
||||
except Exception as err:
|
||||
logger.debug(str(err))
|
||||
logger.info("通知发送失败")
|
||||
else:
|
||||
logger.info(str(wspin) + "账号有效")
|
||||
eid = return_serch[2]
|
||||
ql_enable(eid)
|
||||
logger.info("--------------------\n")
|
||||
else:
|
||||
logger.info("\n新wskey\n")
|
||||
return_ws = getToken(ws) # 使用 WSKEY 请求获取 JD_COOKIE bool jd_ck
|
||||
if return_ws[0]:
|
||||
nt_key = str(return_ws[1])
|
||||
logger.info("wskey转换成功\n")
|
||||
ql_insert(nt_key)
|
||||
else:
|
||||
logger.info("WSKEY格式错误\n--------------------\n")
|
||||
logger.info("执行完成\n--------------------")
|
||||
sys.exit(0)
|
||||
Reference in New Issue
Block a user