-
Notifications
You must be signed in to change notification settings - Fork 2
/
3k_sign.js
2265 lines (2096 loc) · 72.1 KB
/
3k_sign.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* 快手极速版
* 只做签到、开宝箱
*/
// did 不知道的话可以自己胡乱写,保证格式是 ANDROID_11112222233334444(数字部分一共16位,可以是数字和小写字母),
const ksjsb_cookie = "kuaishou.api_st=xxx;did=ANDROID_yyyy;@kuaishou.api_st=;did=ANDROID_zzzz;";
const ksjsb_money = ""; // 提现金额,整数字符串,留空表示按照快手返回的金额列表提现。比如'3',表示每次提现 3 块。【建议留空】
const ksjsb_hour = 8; // 提现时间,整数,精确到小时。比如 8 就是早上 8 点提现,如果在 8:00-8:59 这一个小时内,脚本没跑,那就是不自动提现【建议改掉】
const ksjsb_allMoneyOut = 0; // 是否尝试全部提现,0 不全部提现, 1 全部提现。【建议0,配置成1小心黑号】
const ksjsb_channel = "ALIPAY" // 提现渠道,ALIPAY 支付宝, WECHAT 微信【只有账号同时绑定了支付宝和微信时才生效,只绑定了支付宝咋提现到微信,对吧】
const scriptTitle = "快手极速版";
const selfScript = new chaosConst(scriptTitle);
let runDate = new Date(),
runHour = runDate["getHours"](),
accountSeparator = "@", // CK分割符
runMessage = '',
runResponse,
runChannel = ksjsb_channel,
runCookie = ksjsb_cookie,
runCookieArr = [],
runWithrawCash = ksjsb_money,
runWithrawTime = ksjsb_hour,
runWithrawAggressive = ksjsb_allMoneyOut,
runKsjsbNotify = 0, // 0 不通知 1 提现时通知 2 每次都通知【### 保持 0 即可】
cookiePointer = 0;
// 核心类,定义了所有需要的操作
class cookieEntityClass {
constructor(T) {
let apiSt = T["match"](/(kuaishou.api_st=[\w\-]+)/)[1] + ';';
let did = T["match"](/(did=[\w\-]+)/)[1] + ';';
this["index"] = ++cookiePointer;
this["cookie"] = "kpn=NEBULA; kpf=ANDROID_PHONE; " + did + " ver=10.3; appver=10.3.20.24977; language=zh-cn; countryCode=CN; sys=ANDROID_10; client_key=3c2cd3f3;" + apiSt;
this["name"] = this["index"];
this["valid"] = false; // 默认无效,调用过用户信息后则变为有效
this["bindAlipay"] = false;
this["alipay"] = '';
this["bindWechat"] = false;
this["wechat"] = '';
this["needSms"] = false;
}
// 查询账号详情
async ["getUserInfo"]() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/activity/earn/overview/basicInfo",
p = '',
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
S["result"] == 1 ? (this["valid"] = true, this["name"] = S["data"]["userData"]["nickname"], this["cashBalance"] = S["data"]["totalCash"], this["coinBalance"] = S["data"]["totalCoin"], this["allCash"] = S["data"]["allCash"], console["log"]("账号[" + this["name"] + "]账号余额" + this["cashBalance"] + '元,' + this["coinBalance"] + "金币,未审核余额" + Math["floor"](parseFloat(this["allCash"]) - parseFloat(this["cashBalance"])) + '元')) : console["log"]("账号[" + this["name"] + "]查询账号信息失败:" + S["error_msg"]);
} catch (E) {
console['log']("获取用户详情(getUserInfo)异常:" + E)
}
}
// 分享得金币任务
async ['setShare']() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/account/withdraw/setShare",
p = '',
C = prepareRequestEntity(c, this['cookie'], p);
await doRequest("post", C);
let S = runResponse;
if (!S) {
return;
}
S["result"] == 1 ? (console["log"]("账号[" + this["name"] + "]准备分享得金币"), await selfScript["wait"](357), await this["taskShareReward"](122)) : console["log"]("账号[" + this["name"] + "]分享失败:" + S["error_msg"]);
} catch (E) {
console['log']("准备分享得金币异常:" + E)
}
}
// 执行分享得金币任务
async ["taskShareReward"](T) {
try {
let p = "https://nebula.kuaishou.com/rest/n/nebula/daily/report?taskId=" + T,
C = '',
S = prepareRequestEntity(p, this["cookie"], C);
await doRequest("get", S);
let a = runResponse;
if (!a) {
return;
}
a["result"] == 1 ? console["log"]("账号[" + this["name"] + "]完成任务[" + T + "]成功,获得" + a["data"]['amount'] + '金币') : console["log"]("账号[" + this["name"] + "]完成任务[" + T + "]失败:" + a["error_msg"]);
} catch (E) {
console['log']("执行分享得金币任务异常:" + E)
}
}
// 获取签到信息
async ['getSignInfo']() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/sign/queryPopup",
p = '',
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
S["result"] == 1 ? (console['log']("账号[" + this["name"] + "]今天" + (S["data"]["nebulaSignInPopup"]["todaySigned"] ? '已' : '未') + '签到'), !S["data"]["nebulaSignInPopup"]["todaySigned"] && (await selfScript["wait"](357), await this["doSign"](), await selfScript["wait"](357), await this["setShare"]())) : console["log"]("账号[" + this["name"] + "]查询签到信息失败:" + S["error_msg"]);
} catch (E) {
console['log']("获取签到信息异常:" + E)
}
}
// 执行签到操作
async ["doSign"]() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/sign/sign?source=activity",
p = '',
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
if (S["result"] == 1) {
console['log']("账号[" + this["name"] + "]签到成功:" + S["data"]["toast"]);
await selfScript["wait"](357);
} else {
console["log"]("账号[" + this['name'] + "]签到失败:" + S["error_msg"]);
}
} catch (E) {
console['log']("签到异常:" + E)
}
}
// 开宝箱任务
async ["openBox"](T) {
try {
let p = 'https://nebula.kuaishou.com/rest/n/nebula/box/explore?isOpen=' + T + "&isReadyOfAdPlay=true",
C = '',
S = prepareRequestEntity(p, this["cookie"], C);
await doRequest("get", S);
let a = runResponse;
if (!a) {
return;
}
a["result"] == 1 ? T == true ? a["data"]["commonAwardPopup"] && a["data"]["commonAwardPopup"]["awardAmount"] ? (console["log"]("账号[" + this["name"] + "]开宝箱获得" + a["data"]["commonAwardPopup"]["awardAmount"] + '金币')) : console["log"]("账号[" + this["name"] + "]开宝箱没有获得金币") : a['data']["openTime"] > -1 ? (console["log"]("账号[" + this["name"] + "]开宝箱冷却时间还有" + Math["floor"](a["data"]["openTime"] / 1000) + '秒'), a["data"]['openTime'] == 0 && (await selfScript["wait"](357), await this["openBox"](true))) : console["log"]("账号[" + this["name"] + "]开宝箱次数已用完") : T == true ? console["log"]('账号[' + this["name"] + "]开宝箱失败:" + a["error_msg"]) : console["log"]("账号[" + this["name"] + "]查询宝箱状态失败:" + a["error_msg"]);
} catch (E) {
console['log']("开宝箱异常:" + E)
}
}
// 提现任务
async ["withdraw"](T) {
try {
// 检查是否绑定了提现渠道
if (!this["bindAlipay"] && !this["bindWechat"]) {
justLogAndAppend("账号[" + this["name"] + "]未绑定提现账号,不执行提现");
return;
}
// 默认支付宝
let channel = "ALIPAY"
// 同时绑定的话使用配置的提现通道
if (this["bindAlipay"] && this["bindWechat"]) {
channel = runChannel
} else if (this["bindWechat"]) {
channel = "WECHAT"
}
let channelName = channel == "ALIPAY" ? "支付宝" : '微信';
justLogAndAppend("账号[" + this["name"] + "]提现渠道:" + channelName);
let p = parseInt(T * 100),
C = channel,
S = channelName,
a = C == "ALIPAY" ? this["alipay"] : this["wechat"],
Y = "https://www.kuaishoupay.com/pay/account/h5/withdraw/apply",
j = "account_group_key=NEBULA_CASH_ACCOUNT&mobile_code=&fen=" + p + "&provider=" + C + "&total_fen=" + p + "&commission_fen=0&third_account=" + C + "&attach=&biz_content=&session_id=",
Z = prepareRequestEntity(Y, this['cookie'], j);
await doRequest("post", Z);
let Q = runResponse;
if (!Q) {
return;
}
Q["result"] == "SUCCESS" ? justLogAndAppend('账号' + this["index"] + '[' + this["name"] + "]提现" + T + '元到' + S + '[' + a + "]成功") : justLogAndAppend('账号' + this["index"] + '[' + this["name"] + "]提现" + T + '元到' + S + '[' + a + "]失败:" + Q["msg"]);
} catch (E) {
console["log"]("执行提现(withdraw)异常:" + E);
}
}
// 执行尝试提现操作
async ["withdrawOverview"]() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/outside/withdraw/overview?appver=10.2.20.2021",
p = '',
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
if (S["result"] == 1) {
// 已提现
if (S["data"]["isLimit"] == true) {
console["log"]("账号[" + this["name"] + "]今天已经提现过喽");
return;
}
let a = parseFloat(this["cashBalance"]);
// 全部提现
if (runWithrawAggressive == 1) {
if (a < 0.3) {
justLogAndAppend("账号[" + this["name"] + "]余额不足0.3元,不提现");
} else {
let Y = Math["floor"](a * 10) / 10;
Y = Y > 50 ? 50 : Y;
justLogAndAppend("账号[" + this["name"] + "]准备全部提现(最大化提现)" + Y + '元');
await selfScript["wait"](357);
await this["withdraw"](Y);
}
} else {
// 没有配置提现金额时按照提现列表提现
if (!runWithrawCash) {
for (let Z of S["data"]["enWithdrawList"]["sort"](function (Q, B) {
return B - Q;
})) {
if (a >= parseFloat(Z)) {
justLogAndAppend("账号[" + this["name"] + "]准备提现" + Z + '元');
await selfScript["wait"](357);
await this["withdraw"](Z);
return;
}
}
justLogAndAppend("账号[" + this["name"] + "]余额不足,可提现额度:" + S["data"]["enWithdrawList"]["join"](','));
} else {
// 否则按照配置的值提现
a >= parseFloat(runWithrawCash) ? (justLogAndAppend("账号[" + this["name"] + "]准备提现" + runWithrawCash + '元'), await selfScript["wait"](357), await this["withdraw"](runWithrawCash)) : justLogAndAppend("账号[" + this["name"] + "]余额不足" + runWithrawCash + "元,不提现");
}
}
} else {
console["log"]("账号[" + this["name"] + "]查询提现列表失败:" + S["error_msg"]);
}
} catch (E) {
console["log"]("尝试提现(withdrawOverview)异常:" + E);
}
}
// 查询账号详情
async ["accountOverview"]() {
try {
let c = "https://nebula.kuaishou.com/rest/n/nebula/account/overview",
p = '',
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
if (S["result"] == 1) {
this["coinBalance"] = S["data"]["coinBalance"];
this["cashBalance"] = S["data"]["cashBalance"];
let a = S["data"]["exchangeCoinState"];
justLogAndAppend("账号[" + this["name"] + "]账号余额" + this["cashBalance"] + '元,' + this["coinBalance"] + '金币');
// 更改金币兑换方式为自动
a == 2 && (await selfScript["wait"](357), await this["changeExchangeType"](0));
} else {
console["log"]("账号[" + this["name"] + "]查询账号信息失败:" + S["error_msg"]);
}
} catch (E) {
console["log"]("查询账号信息异常:" + E);
}
}
// 更改金币兑换方式
async ['changeExchangeType'](T) {
try {
let p = "https://nebula.kuaishou.com/rest/n/nebula/exchange/changeExchangeType",
C = "{\"type\":" + T + '}',
S = prepareRequestEntity(p, this["cookie"], C);
S["headers"]["Content-Type"] = "application/json";
await doRequest("post", S);
let a = runResponse;
if (!a) {
return;
}
let Y = T == 0 ? "自动兑换" : '手动兑换';
a["result"] == 1 ? console["log"]("账号[" + this["name"] + "]兑换方式更改成功,目前兑换方式为:" + Y) : console["log"]("账号[" + this["name"] + "]兑换方式更改失败:" + a["error_msg"]);
} catch (E) {
console["log"]("更改金币兑换方式异常:" + E);
}
}
// 兑换金币
async ["exchangeCoin"]() {
try {
if (this["coinBalance"] < 100) {
console["log"]("账号[" + this["name"] + "]金币余额不足100,不执行兑换");
return;
}
let c = "https://nebula.kuaishou.com/rest/n/nebula/exchange/coinToCash/submit",
p = "{\"coinAmount\":" + this["coinBalance"] + ",\"token\":\"rE2zK-Cmc82uOzxMJW7LI2-wTGcKMqqAHE0PhfN0U4bJY4cAM5Inxw\"}",
C = prepareRequestEntity(c, this["cookie"], p);
C['headers']["Content-Type"] = "application/json";
await doRequest("post", C);
let S = runResponse;
if (!S) {
return;
}
if (S["result"] == 1) {
let j = Math["floor"](this['coinBalance'] / 100) * 100,
Z = Math["floor"](this["coinBalance"] / 100) / 100;
console["log"]("账号[" + this["name"] + "]兑换金币成功,将" + j + "金币兑换成" + Z + '元');
} else {
console["log"]("账号[" + this["name"] + "]兑换金币失败:" + S["error_msg"]);
}
} catch (E) {
console["log"]("兑换金币异常:" + E);
}
}
// 抽奖签到
async ["luckydrawSign"]() {
try {
let c = "https://activity.e.kuaishou.com/rest/r/game/sign-in",
p = '',
C = prepareRequestEntity(c, this['cookie'], p);
await doRequest("get", C);
let S = runResponse;
if (!S) {
return;
}
S["result"] == 1 ? S['data']["isShow"] && console["log"]("账号[" + this["name"] + "]抽奖页签到成功") : (console["log"]("账号[" + this["name"] + "]查询抽奖签到情况失败:" + S["error_msg"]), S["error_msg"]["indexOf"]('激励游戏未在运营') > -1 && (this["hasLuckydraw"] = false));
} catch (E) {
console["log"]("抽奖页签到异常:" + E)
}
}
// 查询账号绑定信息
async ["bindInfo"]() {
try {
let c = "https://www.kuaishoupay.com/pay/account/h5/provider/bind_info",
p = "account_group_key=NEBULA_CASH_ACCOUNT&bind_page_type=3",
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("post", C);
let S = runResponse;
if (!S) {
return;
}
if (S["result"] == "SUCCESS") {
let Y = "未绑定支付宝",
j = "未绑定微信";
S["alipay_bind"] == true && (this["bindAlipay"] = true, this["alipay"] = S['alipay_nick_name'], Y = "已绑定支付宝[" + S["alipay_nick_name"] + ']');
S["wechat_bind"] == true && (this["bindWechat"] = true, this["wechat"] = S["wechat_nick_name"], j = "已绑定微信[" + S["wechat_nick_name"] + ']');
console["log"]("账号[" + this["name"] + ']' + j + ',' + Y);
} else {
console["log"]("账号[" + this["name"] + "]查询提现账号绑定情况失败:" + S["error_msg"]);
}
} catch (E) {
console["log"]("查询提现账号绑定情况异常:" + E);
}
}
// 查询账号提现详情
async ['accountInfo']() {
try {
let c = "https://www.kuaishoupay.com/pay/account/h5/withdraw/account_info",
p = "account_group_key=NEBULA_CASH_ACCOUNT&providers=",
C = prepareRequestEntity(c, this["cookie"], p);
await doRequest("post", C);
let S = runResponse;
if (!S) {
return;
}
S["result"] == "SUCCESS" ? this["needSms"] = S["need_mobile_code"] : console["log"]("账号[" + this["name"] + "]查询账号提现情况失败:" + S["error_msg"]);
} catch (E) {
console["log"]("查询账号提现情况异常:" + E);
}
}
}
//### 脚本开始
!(async () => {
// TODO 这里没看懂
if (typeof $request !== "undefined") {
await matchScriptCookie();
} else {
// 未能解析 Cookie 的话退出脚本
if (!(await analyseCookie())) {
return;
}
console["log"]("\n============== 看起来一切正常,准备登录 ==============");
// 查询账号详情(校验账号是否有效)
for (let a of runCookieArr) {
await a["getUserInfo"]();
await selfScript["wait"](500);
}
// 全部脚本失效则退出脚本
let p = runCookieArr["filter"](j => j["valid"] == true);
if (p["length"] == 0) {
console["log"]("\n============== 哦哦,所有账号都失效喽,退出 ==============");
return;
}
for (let Z of p) {
console['log']("\n=========== 账号【" + Z["name"] + "】开始做任务啦 ===========");
// 查询签到信息并尝试签到
await Z["getSignInfo"]();
await selfScript["wait"](357);
// 开宝箱
await Z["openBox"](false);
await selfScript["wait"](357);
// 抽奖页签到
await Z["luckydrawSign"]();
await selfScript["wait"](357);
}
console["log"]("\n============== 账号汇总 ==============");
for (let O of p) {
// 账号详情
await O["accountOverview"]();
await selfScript["wait"](357);
// 账号绑定详情
await O["bindInfo"]();
await selfScript["wait"](357);
// 账号提现详情
await O["accountInfo"]();
await selfScript['wait'](200);
}
console["log"]("\n============== 准备自动提现 ==============");
let C = "按提现列表自动提现";
runWithrawCash && (C = "自动提现" + runWithrawCash + '元');
if (runWithrawAggressive) {
C = "全部提现(据说可能黑号哦)";
}
// 运行时间是配置的提现时间
if (runHour == runWithrawTime) {
console["log"]("开始提现啦,提现方式为:" + C);
for (let d of p) {
await d['withdrawOverview'](), await selfScript["wait"](357);
}
} else {
console["log"]("本次运行不提现,提现时间:" + runWithrawTime + '点,提现方式:' + C);
}
// 执行通知
runKsjsbNotify == 2 ? await doNotifyRunMessage() : runKsjsbNotify == 1 && runHour == runWithrawTime && (await doNotifyRunMessage());
}
})()["catch"](T => selfScript["logErr"](T))['finally'](() => selfScript["done"]());
// ### 大概意思是按照 cookie 执行任务,暂时没搞懂
async function matchScriptCookie() {
if ($request["url"]["indexOf"]("appsupport/yoda/biz/info") > -1) {
let c = $request["headers"]["Cookie"]["match"](/(kuaishou.api_st=[\w\-]+)/)[1] + ';';
runCookie ? runCookie["indexOf"](c) == -1 && (runCookie = runCookie + "\n" + c, selfScript["setdata"](runCookie, "ksjsbCookie"), ckList = runCookie["split"]("\n"), selfScript["msg"](scriptTitle + (" 获取第" + ckList["length"] + "个ck成功: " + c))) : (selfScript["setdata"](c, "ksjsbCookie"), selfScript["msg"](scriptTitle + (" 获取第1个ck成功: " + c)));
}
if ($request["url"]["indexOf"]("ksapp/client/package/renew") > -1) {
let p = $request["url"]["match"](/(kuaishou.api_st=[\w\-]+)/)[1] + ';';
runCookie ? runCookie["indexOf"](p) == -1 && (runCookie = runCookie + "\n" + p, selfScript["setdata"](runCookie, "ksjsbCookie"), ckList = runCookie["split"]("\n"), selfScript["msg"](scriptTitle + (" 获取第" + ckList["length"] + "个ck成功: " + p))) : (selfScript["setdata"](p, "ksjsbCookie"), selfScript["msg"](scriptTitle + (" 获取第1个ck成功: " + p)));
}
}
// 解析 cookie
async function analyseCookie() {
if (runCookie) {
for (let a of runCookie["split"](accountSeparator)) {
a && runCookieArr["push"](new cookieEntityClass(a));
}
console["log"]("共找到" + runCookieArr["length"] + "个账号");
return true;
}
console["log"]("CK 列表为空,请将 CK 从环境变量移到脚本,并配置到【ksjsb_cookie】字段");
return false;
}
// 运行通知
async function doNotifyRunMessage() {
try {
if (!runMessage) {
return;
}
notifyBody = "快手极速版运行通知\n\n" + runMessage;
if (runKsjsbNotify > 0) {
selfScript["msg"](notifyBody);
if (selfScript["isNode"]()) {
var c = require("./sendNotify");
await c['sendNotify'](selfScript["name"], notifyBody);
}
} else {
console["log"](notifyBody);
}
} catch (E) {
console["log"]("执行通知异常了,不过完全OJBK");
}
}
function justLogAndAppend(T) {
console["log"](T);
runMessage += T;
runMessage += "\n";
}
// 准备请求实体
// T 是 URL, c 是 cookie, p 是参数
function prepareRequestEntity(T, c, p = '') {
let S = T['replace']('//', '/')["split"]('/')[1];
const a = {
'Host': S,
'Cookie': c
},
Y = {
'url': T,
'headers': a
};
p && (Y["body"] = p, Y['headers']["Content-Type"] = "application/x-www-form-urlencoded", Y["headers"]["Content-Length"] = Y["body"] ? Y["body"]["length"] : 0);
return Y;
}
// 发起请求
// T 是请求方式, c是请求实体,即 prepareRequestEntity 的响应
async function doRequest(T, c) {
runResponse = null;
return new Promise(C => {
selfScript[T](c, async (a, Y, j) => {
try {
if (a) {
console["log"](T + "请求失败");
console["log"](JSON["stringify"](a));
selfScript["logErr"](a);
} else {
catchServerResponseError(j) && (runResponse = JSON["parse"](j));
}
} catch (B) {
selfScript["logErr"](B, Y);
} finally {
C();
}
});
});
}
function catchServerResponseError(T) {
try {
if (typeof JSON["parse"](T) == 'object') {
return true;
} else {
console["log"](T);
}
} catch (p) {
console["log"]("请求服务器异常" + p);
return false;
}
}
// TODO 看起来是用来编码/解码的
var encoderDecoder = {
'_keyStr': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
'encode': function (T) {
var p = '',
C,
S,
a,
Y,
j,
Z,
Q,
B = 0;
T = encoderDecoder["_utf8_encode"](T);
while (B < T["length"]) {
C = T["charCodeAt"](B++);
S = T["charCodeAt"](B++);
a = T["charCodeAt"](B++);
Y = C >> 2;
j = (C & 3) << 4 | S >> 4;
Z = (S & 15) << 2 | a >> 6;
Q = a & 63;
if (isNaN(S)) {
Z = Q = 64;
} else {
isNaN(a) && (Q = 64);
}
p = p + this["_keyStr"]["charAt"](Y) + this["_keyStr"]["charAt"](j) + this["_keyStr"]["charAt"](Z) + this["_keyStr"]["charAt"](Q);
}
return p;
},
'decode': function (T) {
var U = '';
var S,
a,
Y,
j,
Z,
Q,
B,
b = 0;
T = T["replace"](/[^A-Za-z0-9+/=]/g, '');
while (b < T["length"]) {
j = this["_keyStr"]["indexOf"](T["charAt"](b++));
Z = this["_keyStr"]["indexOf"](T["charAt"](b++));
Q = this["_keyStr"]["indexOf"](T["charAt"](b++));
B = this["_keyStr"]["indexOf"](T["charAt"](b++));
S = j << 2 | Z >> 4;
a = (Z & 15) << 4 | Q >> 2;
Y = (Q & 3) << 6 | B;
U = U + String["fromCharCode"](S);
Q != 64 && (U = U + String["fromCharCode"](a));
B != 64 && (U = U + String['fromCharCode'](Y));
}
U = encoderDecoder["_utf8_decode"](U);
return U;
},
'_utf8_encode': function (T) {
T = T["replace"](/rn/g, 'n');
var p = '';
for (var C = 0; C < T["length"]; C++) {
var S = T["charCodeAt"](C);
S < 128 ? p += String["fromCharCode"](S) : S > 127 && S < 2048 ? (p += String["fromCharCode"](S >> 6 | 192), p += String["fromCharCode"](S & 63 | 128)) : (p += String["fromCharCode"](S >> 12 | 224), p += String["fromCharCode"](S >> 6 & 63 | 128), p += String["fromCharCode"](S & 63 | 128));
}
return p;
},
'_utf8_decode': function (T) {
var p = '',
C = 0,
S = c1 = c2 = 0;
while (C < T["length"]) {
S = T["charCodeAt"](C);
if (S < 128) {
p += String["fromCharCode"](S);
C++;
} else {
S > 191 && S < 224 ? (c2 = T["charCodeAt"](C + 1), p += String["fromCharCode"]((S & 31) << 6 | c2 & 63), C += 2) : (c2 = T["charCodeAt"](C + 1), c3 = T["charCodeAt"](C + 2), p += String["fromCharCode"]((S & 15) << 12 | (c2 & 63) << 6 | c3 & 63), C += 3);
}
}
return p;
}
};
// 仅仅是为了让代码看起来乱糟糟的混淆函数
// fxck
function chaosConst(T, c) {
const p = {
'vUthb': function (S, a) {
return S + a;
},
'xansl': '自动提现',
'zYPmU': function (S, a) {
return S(a);
},
'eJcPH': function (S, a) {
return S === a;
},
'Ffwdi': 'SdDDo',
'TZDtX': "call",
'LLmyY': function (S, a) {
return S == a;
},
'YiGml': 'string',
'ObOPk': 'get',
'QMUHn': function (S, a) {
return S === a;
},
'zHSSq': "POST",
'nKUNb': "PUT",
'BUgao': 'put',
'yEKyH': "send",
'vahvK': "env",
'dpfdF': function (S, a) {
return S !== a;
},
'eyKhd': 'qrpCi',
'EUGLY': "exec",
'JrMHo': "getval",
'YTTpc': 'parse',
'laqkM': "lodash_get",
'nyIyV': 'sFSUj',
'tTZNr': "http",
'pWUNv': 'logs',
'PSfXw': "isMute",
'gfRMI': "isNeedRewrite",
'zYZMh': "logSeparator",
'GpvDT': "startTime",
'rwkXM': "getTime",
'XlxAL': "assign",
'EpagF': 'log',
'fSfdS': function (S, a) {
return S + a;
},
'gqCJK': function (S, a) {
return S + a;
},
'Gfcja': "name",
'hekcr': ", 开始!",
'mPAYK': function (S, a) {
return S > a;
},
'PllJg': "fromCharCode",
'iqado': function (S, a) {
return S | a;
},
'MzGTf': function (S, a) {
return S & a;
},
'TKgVx': function (S, a) {
return S !== a;
},
'olIIK': "ITvHD",
'HHxsA': function (S, a) {
return S != a;
},
'CQFuU': "exports",
'uPIiE': function (S, a) {
return S === a;
},
'moxoN': 'yRWdM',
'ndkrr': "undefined",
'abQqZ': function (S, a) {
return S == a;
},
'yNHJl': "object",
'OakBY': 'length',
'JeirW': function (S, a) {
return S - a;
},
'QXdUA': function (S, a) {
return S !== a;
},
'OEsXl': function (S, a) {
return S === a;
},
'UAHdw': 'ILxfY',
'PnEQd': 'SLhlf',
'BkkNj': function (S, a) {
return S > a;
},
'njcCW': function (S, a) {
return S < a;
},
'OaFOK': 'charCodeAt',
'FqswT': function (S, a) {
return S | a;
},
'GzHCj': function (S, a) {
return S << a;
},
'HqOfP': function (S, a) {
return S & a;
},
'YvJVr': function (S, a) {
return S + a;
},
'cPawj': function (S, a) {
return S << a;
},
'kVVAm': function (S, a) {
return S << a;
},
'MUUEt': "eRzSJ",
'RCuQp': "stringify",
'WigGt': 'UVTpF',
'nkjIw': "replace",
'EHEwT': function (S, a) {
return S < a;
},
'ELjRv': function (S, a) {
return S | a;
},
'hiJrK': function (S, a) {
return S >> a;
},
'wSNNM': function (S, a) {
return S | a;
},
'icCLE': function (S, a) {
return S | a;
},
'TbLse': "getdata",
'OECAm': function (S, a) {
return S === a;
},
'lKqWU': 'XDylR',
'nkxqU': "OZDut",
'pvYcm': function (S, a) {
return S !== a;
},
'RtLih': "fecFj",
'OdOgo': "setdata",
'pYeKT': function (S, a) {
return S !== a;
},
'Hvrfl': "RfVYF",
'ojkaK': "url",
'lwNtd': "openUrl",
'fkYsv': "media-url",
'QiEkZ': "mediaUrl",
'bpiZV': "rqroY",
'WeMSp': "AwQOv",
'QOfCX': '@chavy_boxjs_userCfgs.httpapi',
'YNSwh': "@chavy_boxjs_userCfgs.httpapi_timeout",
'WJSeA': "timeout",
'UyCjF': "cron",
'evLIU': "split",
'stalv': "*/*",
'TMZRE': "catch",
'KrjuT': "isNode",
'gKGOw': "path",
'zezEm': function (S, a) {
return S(a);
},
'RjPnH': "resolve",
'xXhjZ': 'dataFile',
'lkrOZ': 'existsSync',
'UXuFw': function (S, a) {
return S && a;
},
'KoZWa': "BwDxP",
'fPWUS': "tcvnO",
'yOzYr': "readFileSync",
'tMFnY': function (S, a) {
return S(a);
},
'LqimL': function (S, a) {
return S(a);
},
'rqfCP': "cwd",
'Bktev': "data",
'MSCAv': "writeFileSync",
'VBFSP': 'jCvBn',
'sQUUP': 'VtzwK',
'kdHtp': ".$1",
'mKOJb': "open-url",
'XReEV': function (S, a) {
return S !== a;
},
'whlcJ': "tAHnY",
'bACgC': 'WYytN',
'EenlS': function (S, a) {
return S !== a;
},
'rGDJj': "toString",
'zkpOW': 'match',
'nWjqV': "slice",
'BoyEO': "reduce",
'BRBwt': function (S, a) {
return S - a;
},
'Tosyp': "最大化提现",
'BzvSr': "VFxhh",
'eTTEO': function (S, a) {
return S === a;
},
'UTTFk': "YehTV",
'IBedw': "isDirectory",
'YBFrW': function (S, a, Y) {
return S(a, Y);
},
'avqsd': "rmdirSync",
'XaBsU': "test",
'kBRzH': "null",
'XGvRG': 'lodash_set',
'OuTOW': "setval",
'ZGhoB': "IWXJI",
'NvGvD': "isSurge",
'gXLLg': "isLoon",
'QEklD': "read",
'JilvT': "valueForKey",
'GvmCb': "loaddata",
'Erjln': "write",
'TEhQN': "isQuanX",
'SItKq': "writedata",
'mAQuS': "JRiyX",
'wJEVG': "VnxND",
'UnUmH': "got",
'VWREu': function (S, a) {
return S(a);
},
'UfFmc': 'cktough',
'KUpZH': 'ckjar',
'wbhLH': 'CookieJar',
'Ufsfg': "headers",
'EYucJ': "Cookie",
'EwYhm': 'cookieJar',
'XxBGY': function (S, a) {
return S && a;
},
'uZTTG': 'body',
'RacES': "statusCode",
'PWoQA': 'status',
'hwvxW': function (S, a, Y, j) {
return S(a, Y, j);
},
'WqVMM': "unlinkSync",
'jZbbI': "forEach",
'fruUq': "rEDBj",
'ZCHSn': "utuzS",
'jBBop': "map",
'zyxAx': "setCookieSync",
'mcwDC': "XerNB",
'bdYaD': "logErr",
'RKyIx': function (S, a, Y, j) {
return S(a, Y, j);
},
'mGhWK': "opts",
'pswtb': 'initGotEnv',
'uZRAe': "redirect",
'rMFJs': "then",
'pYoPM': function (S, a) {
return S && a;
},
'YiNrA': function (S, a, Y, j) {
return S(a, Y, j);
},
'wdjsG': function (S, a, Y, j) {
return S(a, Y, j);
},
'jSddq': function (S, a) {
return S - a;
},
'wQqon': function (S, a) {
return S + a;
},
'FZjHX': function (S, a) {
return S + a;
},
'QFjSh': ", 结束! 🕛 ",
'kOHbb': "method",
'fdBtA': "fetch",
'XMRkJ': "http://",
'awTOK': "/v1/scripting/evaluate",
'EtYHG': "uuOFb",
'WFTAO': "Content-Type",
'UWYCE': "application/x-www-form-urlencoded",
'JBlns': "post",
'Wlkha': "atBfJ",
'OgVdL': "nJAlO",
'tKavq': 'VVpAe',
'skKHu': 'YhuYF',
'qmHBe': function (S) {
return S();
},
'qpgdd': function (S, a) {
return S === a;
},
'nPTxz': "EqePu",
'yRDNE': "ESIAN",
'gwRAk': function (S, a) {
return S && a;
},
'GCFnt': function (S, a, Y, j) {
return S(a, Y, j);
},