forked from smallfawn/decode_action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.js
1958 lines (1958 loc) · 74.6 KB
/
output.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
//Tue Feb 11 2025 05:14:32 GMT+0000 (Coordinated Universal Time)
//Base:https://github.com/echo094/decode-js
//Modify:https://github.com/smallfawn/decode_action
const $ = new Env("阿里云社区"),
notify = $.isNode() ? require("./sendNotify") : "",
ckName = "aliyunWeb_data";
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || [];
const controlTime = ($.isNode() ? process.env.aliyunWeb_time : $.getdata("aliyunWeb_time")) || "12",
controlScene = ($.isNode() ? process.env.aliyunWeb_scene : $.getdata("aliyunWeb_scene")) || "true",
controlStock = ($.isNode() ? process.env.aliyunWeb_stock : $.getdata("aliyunWeb_stock")) || "true",
controlVideo = ($.isNode() ? process.env.aliyunWeb_video : $.getdata("aliyunWeb_video")) || "true",
taskGroup = [{
code: "",
name: "我的社区"
}, {
code: "ecs",
name: "弹性计算"
}, {
code: "computenest",
name: "计算巢"
}, {
code: "yitian",
name: "倚天"
}, {
code: "wuying",
name: "无影"
}, {
code: "cloudnative",
name: "云原生"
}, {
code: "storage",
name: "云存储"
}, {
code: "luoshen",
name: "飞天洛神云网络"
}, {
code: "database",
name: "数据库"
}, {
code: "polardb",
name: "PolarDB开源"
}, {
code: "bigdata",
name: "大数据与机器学习"
}, {
code: "modelscope",
name: "ModelScope模型即服务"
}, {
code: "viapi",
name: "视觉智能"
}, {
code: "dns",
name: "域名解析DNS"
}, {
code: "iot",
name: "物联网"
}, {
code: "devops",
name: "云效DevOps"
}, {
code: "aliyun_linux",
name: "龙蜥操作系统"
}, {
code: "modelstudio",
name: "百炼大模型"
}, {
code: "tongyi",
name: "通义大模型"
}];
$.userIdx = 0;
$.userList = [];
$.notifyMsg = [];
$.succCount = 0;
$.is_debug = ($.isNode() ? process.env.IS_DEDUG : $.getdata("is_debug")) || "false";
async function main() {
await proccessMain($.userList);
$.title = "共" + $.userList.length + "个账号,成功" + $.succCount + "个,失败" + ($.userList.length - 0 - $.succCount) + "个";
await sendMsg($.notifyMsg.join("\n"), {
$media: $.avatar
});
}
async function proccessMain(_0x465755) {
const _0x16bd4c = 10;
let _0xdcc8fc = 0;
async function _0x428fa5() {
const _0x4a8bc3 = _0x465755.slice(_0xdcc8fc, _0xdcc8fc + _0x16bd4c);
_0xdcc8fc += _0x16bd4c;
await Promise.allSettled(_0x4a8bc3.map(_0x2e54ba => _0x1fe25d(_0x2e54ba)));
_0xdcc8fc < _0x465755.length && (await _0x428fa5());
}
await _0x428fa5();
async function _0x1fe25d(_0x59437a) {
try {
const _0x4e478b = Date.now();
this.userScore = (await _0x59437a.interactData()) ?? {};
if (_0x59437a.ckStatus) {
if (_0x4e478b < new Date(new Date().setHours(Math.floor(controlTime), 0, 0, 0)).getTime()) {
for (let _0x35c6ac of taskGroup) {
const _0x57451a = await _0x59437a.getUserSpaceSignInDetail(_0x35c6ac.code),
_0x167780 = await _0x59437a.getTasks(_0x57451a);
await _0x59437a.signin(_0x167780, _0x35c6ac.name);
await $.wait(_0x59437a.getRandomTime());
const _0x3add29 = await _0x59437a.assessSignInBonusQualification(_0x57451a, _0x35c6ac.name);
await $.wait(_0x59437a.getRandomTime());
_0x3add29 && (await _0x59437a.receiveSignInBonus(_0x57451a, _0x35c6ac.name), await $.wait(_0x59437a.getRandomTime()));
}
const _0x4ed41f = await _0x59437a.getEbooks();
await $.wait(_0x59437a.getRandomTime());
const _0x3597e4 = await _0x59437a.getCsrfToken(_0x4ed41f, "ebook");
await $.wait(_0x59437a.getRandomTime());
await _0x59437a.addBookComment(_0x4ed41f, _0x3597e4);
await $.wait(_0x59437a.getRandomTime());
for (let _0x4fb9c9 = 0; _0x4fb9c9 < 5; _0x4fb9c9++) {
const _0x5b0b32 = await _0x59437a.getArticles();
await $.wait(_0x59437a.getRandomTime());
await _0x59437a.likeOrNotLike(_0x5b0b32, "aliyun-public-like", 0);
await $.wait(_0x59437a.getRandomTime());
await _0x59437a.likeOrNotLike(_0x5b0b32, "aliyun-public-favorite", 0);
await $.wait(_0x59437a.getRandomTime());
_0x4fb9c9 === 0 && (await _0x59437a.addComment(_0x5b0b32), await $.wait(_0x59437a.getRandomTime()), await _0x59437a.likeOrNotLike(_0x5b0b32, "aliyun-public-share", 0), await $.wait(_0x59437a.getRandomTime()));
const _0x427f73 = await _0x59437a.getAsks();
await $.wait(_0x59437a.getRandomTime());
if (_0x427f73 && _0x427f73?.["id"]) {
const _0x1b7ded = await _0x59437a.getCsrfToken(_0x427f73.id, "ask");
await $.wait(_0x59437a.getRandomTime());
const _0x1bb099 = await _0x59437a.getAskDetail(_0x427f73);
await $.wait(_0x59437a.getRandomTime());
_0x1bb099 && (await _0x59437a.voteAnswer(_0x427f73.id, _0x1bb099, _0x1b7ded, 1), await $.wait(_0x59437a.getRandomTime()));
}
}
JSON.parse(controlScene) && (await _0x59437a.doScene(), await $.wait(_0x59437a.getRandomTime()));
JSON.parse(controlVideo) && (await _0x59437a.playVideo(), await $.wait(_0x59437a.getRandomTime()));
JSON.parse(controlStock) && (await _0x59437a.getGroupItems());
this.pendingScore = await _0x59437a.getUserTotalPendingScore();
$.title = "获得待领取积分: " + this.pendingScore;
DoubleLog("🎉 当前积分: " + this.userScore + ", 待领取积分: " + this.pendingScore);
} else {
for (let _0x37a5ab of taskGroup) {
const _0x3ba052 = await _0x59437a.getUserSpaceSignInDetail(_0x37a5ab.code),
_0x44744c = await _0x59437a.assessSignInBonusQualification(_0x3ba052, _0x37a5ab.name);
await $.wait(_0x59437a.getRandomTime());
_0x44744c && (await _0x59437a.receiveSignInBonus(_0x3ba052, _0x37a5ab.name), await $.wait(_0x59437a.getRandomTime()));
}
this.pendingScore = await _0x59437a.getUserTotalPendingScore();
await $.wait(_0x59437a.getRandomTime());
await _0x59437a.collect();
await $.wait(_0x59437a.getRandomTime());
await $.wait(_0x59437a.getRandomTime());
const _0x4b11af = (await _0x59437a.getFavors()) ?? [];
await $.wait(_0x59437a.getRandomTime());
if (_0x4b11af.length) {
for (let _0x55c29c of _0x4b11af) {
await _0x59437a.likeOrNotLike(_0x55c29c.objectId, "aliyun-public-like", 1);
await $.wait(_0x59437a.getRandomTime());
await _0x59437a.likeOrNotLike(_0x55c29c.objectId, "aliyun-public-favorite", 1);
await $.wait(_0x59437a.getRandomTime());
}
}
JSON.parse(controlStock) && (await _0x59437a.getGroupItems());
let _0x5abc4e = (await _0x59437a.interactData()) ?? {};
$.title = "本次运行共获得" + (this.pendingScore || 0) + "积分";
DoubleLog("🎉 领取积分: " + this.pendingScore + ", 当前积分: " + _0x5abc4e);
}
$.succCount++;
} else {
DoubleLog("⛔️ 「" + (_0x59437a.userName ?? "账号" + _0xdcc8fc) + "」签到失败, 用户需要去登录");
}
} catch (_0x13f21d) {
throw _0x13f21d;
}
}
}
class UserInfo {
constructor(_0x34292b) {
this.index = ++$.userIdx;
this.token = "" || _0x34292b.token || _0x34292b;
this.userId = "" || _0x34292b.userId;
this.userName = _0x34292b.userName || "";
this.avatar = _0x34292b.avatar;
this.ckStatus = true;
this.pendingScore = 0;
this.userScore = 0;
this.sceneId = "";
this.resourceFrom = "";
this.sectionId = "";
this.ip = "";
this.host = "https://developer.aliyun.com/developer/api";
this.headers = {
Cookie: this.token,
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
Referer: "https://developer.aliyun.com/"
};
this.getRandomTime = () => randomInt(1, 2);
this.fetch = async _0x454b16 => {
try {
if (typeof _0x454b16 === "string") {
_0x454b16 = {
url: _0x454b16
};
}
if (_0x454b16?.["url"]?.["startsWith"]("/")) {
_0x454b16.url = this.host + _0x454b16.url;
}
const _0x2a3ee6 = await Request({
..._0x454b16,
headers: _0x454b16.headers || this.headers,
url: _0x454b16.url || this.baseUrl
});
debug(_0x2a3ee6, _0x454b16?.["url"]?.["replace"](/\/+$/, "")["substring"](_0x454b16?.["url"]?.["lastIndexOf"]("/") + 1));
if (_0x2a3ee6?.["code"] == 40001) {
throw new Error(_0x2a3ee6?.["message"] || "用户需要去登录");
}
return _0x2a3ee6;
} catch (_0x3603b8) {
this.ckStatus = false;
$.log("⛔️ 请求发起失败!" + _0x3603b8);
}
};
}
async getUser() {
try {
const _0x30cfa6 = {
url: "/my/user/getUser",
type: "get"
};
await this.fetch(_0x30cfa6);
} catch (_0x3de38b) {
this.ckStatus = false;
$.log("⛔️ 获取签到任务列表失败! " + _0x3de38b);
}
}
async assessSignInBonusQualification(_0x57739a, _0x3289c8) {
if (!_0x57739a) {
return null;
}
try {
const _0xc8c3d6 = {
url: "/sign/assessSignInBonusQualification",
type: "get",
params: {
taskGroupId: _0x57739a
}
};
let _0x12b8a2 = await this.fetch(_0xc8c3d6);
return _0x12b8a2?.["data"];
} catch (_0x2b810f) {
this.ckStatus = false;
$.log("⛔️ 查询领奖条件失败! " + _0x2b810f);
}
}
async receiveSignInBonus(_0x51e1e2, _0x44e0ca) {
try {
const _0x2298a5 = {
url: "/sign/receiveSignInBonus",
type: "post",
dataType: "form",
body: {
taskGroupId: _0x51e1e2
}
};
let _0x1e91a6 = await this.fetch(_0x2298a5);
if (_0x1e91a6?.["code"] == "200") {
const _0x4b57b1 = _0x1e91a6?.["data"] || 0;
$.log("✅ 抽奖 - " + (_0x44e0ca || "default") + ": 获得 " + _0x4b57b1 + " 积分");
} else {
$.log("⛔️ 抽奖 - " + (_0x44e0ca || "default") + ": " + _0x1e91a6?.["message"]);
}
} catch (_0x485ef1) {
this.ckStatus = false;
$.log("⛔️ 抽奖失败! " + _0x485ef1);
}
}
async getUserSpaceSignInDetail(_0x4aa042) {
try {
const _0x3f87ae = {
url: "/sign/getUserSpaceSignInDetail",
type: "get",
params: {
excode: _0x4aa042
}
};
let _0x4f1f1f = await this.fetch(_0x3f87ae);
const _0xd98e3f = _0x4f1f1f?.["data"]?.["taskGroupId"] || null;
return _0xd98e3f;
} catch (_0x23dca9) {
this.ckStatus = false;
$.log("⛔️ 获取签到任务列表失败! " + _0x23dca9);
}
}
async getTasks(_0x388291) {
if (!_0x388291) {
return null;
}
try {
const _0x55df5c = {
url: "/task/getTaskGroup?groupId=" + _0x388291,
type: "get"
};
let _0x502750 = await this.fetch(_0x55df5c);
const _0x3d0b2a = _0x502750?.["data"]?.["taskList"];
let _0x3b8e2c = {};
if (_0x3d0b2a.length) {
const _0x95ad55 = new Date().getTime();
for (let _0xd9d09f of _0x3d0b2a) {
if (_0x95ad55 >= _0xd9d09f.gmtEnableStart && _0x95ad55 <= _0xd9d09f.gmtEnableEnd) {
const _0x157cb6 = JSON.parse(_0xd9d09f.finishRule.replace(/"/g, "\""));
_0x3b8e2c.actionCode = _0x157cb6.actions[0].actionCode;
_0x3b8e2c.activityCode = _0x157cb6.actions[0].actionCode;
_0x3b8e2c.objectId = _0x157cb6.actions[0].objectId;
}
}
}
return _0x3b8e2c;
} catch (_0x371dcc) {
this.ckStatus = false;
$.log("⛔️ 获取签到任务列表失败! " + _0x371dcc);
}
}
async signin(_0x361610, _0x368b5c) {
if (!_0x361610) {
$.log("✅ 签到 - " + (_0x368b5c || "default") + ": 该社区无签到任务");
return;
}
try {
const _0x563e15 = {
url: "/task/actionLog",
type: "post",
dataType: "form",
body: _0x361610
};
let _0x20762e = await this.fetch(_0x563e15);
$.log("✅ 签到 - " + (_0x368b5c || "default") + ": " + _0x20762e?.["message"]);
} catch (_0xbf60c9) {
this.ckStatus = false;
$.log("⛔️ 签到失败! " + _0xbf60c9);
}
}
async getArticles() {
try {
const _0x1fd136 = Math.floor(Math.random() * 31) + 1,
_0x1e8694 = {
url: "https://developer.aliyun.com/group/aliware/article_hot?pageNum=" + _0x1fd136,
type: "get"
};
let _0x27d3e9 = await this.fetch(_0x1e8694);
const _0x5e2433 = $.Cheerio.load(_0x27d3e9),
_0x5eab1e = _0x5e2433(".community-detail-content"),
_0x3cdab8 = _0x5eab1e.find(".community-list").map((_0x55c320, _0x83ea73) => {
return {
id: _0x5e2433(_0x83ea73).find(".feed-item").attr("data-id"),
name: _0x5e2433(_0x83ea73).find(".feed-item-content-title h3").text()
};
}).get(),
_0x502228 = _0x3cdab8[Math.floor(Math.random() * _0x3cdab8.length)],
{
id: _0x52f68e,
name: _0x183ea6
} = _0x502228;
$.log("✅ 随机获取文章id: " + _0x52f68e + ", 标题: " + _0x183ea6);
return _0x52f68e;
} catch (_0x257822) {
this.ckStatus = false;
$.log("⛔️ 获取文章列表失败! " + _0x257822);
}
}
async getEbooks() {
try {
const _0x9de6ca = Math.floor(Math.random() * 501) + 1,
_0xaa66e4 = {
url: "https://developer.aliyun.com/ebook/index/__0_0_0_" + _0x9de6ca,
type: "get"
};
let _0x539984 = await this.fetch(_0xaa66e4);
const _0x691836 = $.Cheerio.load(_0x539984),
_0xf66626 = _0x691836(".ebook-home-list"),
_0x358a2d = _0xf66626.find(".ebook-home-item").map((_0x1c36ca, _0x24b4a6) => {
return {
id: _0x691836(_0x24b4a6).attr("href").replace("/ebook/", ""),
name: _0x691836(_0x24b4a6).find(".ebook-home-title").text()
};
}).get(),
_0x16608f = _0x358a2d[Math.floor(Math.random() * _0x358a2d.length)],
{
id: _0x531095,
name: _0x22f497
} = _0x16608f;
$.log("✅ 随机电子书id: " + _0x531095 + ", 标题: " + _0x22f497);
return _0x531095;
} catch (_0x552281) {
this.ckStatus = false;
$.log("⛔️ 获取电子书列表失败! " + _0x552281);
}
}
async getAsks() {
try {
const _0x1c6abf = Math.floor(Math.random() * 31) + 1,
_0xcbdfa2 = {
url: "https://developer.aliyun.com/ask?pageNum=" + _0x1c6abf,
type: "get"
};
let _0x530241 = await this.fetch(_0xcbdfa2);
const _0x401c61 = $.Cheerio.load(_0x530241),
_0x300bff = _0x401c61(".askProduct-list"),
_0x13abb0 = _0x300bff.find(".askProduct-item").map((_0x24aec7, _0x3ff0e7) => {
return {
id: _0x401c61(_0x3ff0e7).attr("data-id") || "",
name: _0x401c61(_0x3ff0e7).find(".askProduct-item-title-text h3").text() || "",
answer: parseInt(_0x401c61(_0x3ff0e7).find(".askProduct-item-info-answer").text()) || ""
};
}).filter((_0x1b4dd3, _0x786f88) => _0x786f88.answer > 0).get(),
_0x3f8f19 = _0x13abb0[Math.floor(Math.random() * _0x13abb0.length)];
if (_0x3f8f19?.["id"] && _0x3f8f19?.["name"]) {
const {
id: _0x237fc1,
name: _0x18e1df
} = _0x3f8f19;
$.log("✅ 随机获取问答id: " + _0x237fc1 + ", 标题: " + _0x18e1df);
return _0x3f8f19;
}
return null;
} catch (_0x57a0b7) {
this.ckStatus = false;
$.log("⛔️ 获取问答列表失败! " + _0x57a0b7);
}
}
async getAskDetail(_0x23695a) {
try {
const _0xfa3695 = {
url: "https://developer.aliyun.com/ask/" + _0x23695a.id,
type: "get"
};
let _0x358699 = await this.fetch(_0xfa3695);
const _0x3af0bf = $.Cheerio.load(_0x358699),
_0x42279c = _0x3af0bf(".answer-list"),
_0x2760a8 = _0x42279c.find(".answer-item").map((_0x58f6f2, _0x3ee105) => {
return {
id: _0x3af0bf(_0x3ee105).attr("data-id") || ""
};
}).get(),
_0x492656 = _0x2760a8[Math.floor(Math.random() * _0x23695a.answer)];
if (_0x492656) {
const {
id: _0xaa3e44
} = _0x492656;
$.log("✅ 随机获取问题问答id: " + _0xaa3e44);
return _0xaa3e44;
}
return null;
} catch (_0x55e6a4) {
this.ckStatus = false;
$.log("⛔️ 随机获取问题问答失败! " + _0x55e6a4);
}
}
async likeOrNotLike(_0x1079a5, _0x328a11, _0x5eedfa) {
try {
const _0xf3d215 = {
url: "https://ucc.aliyun.com/uccPagingComponent/likeOrNotLike",
type: "get",
params: {
bizCategory: "yq-article",
actionCode: _0x328a11,
objectId: _0x1079a5,
status: _0x5eedfa,
uccCsrfToken: await this.getUccCsrfToken(),
callback: getCallback()
}
};
await this.fetch(_0xf3d215);
let _0x50cf35 = "文章" + (_0x5eedfa === 1 ? "取消" : "");
if (_0x328a11 === "aliyun-public-like") {
_0x50cf35 += "点赞";
} else {
if (_0x328a11 === "aliyun-public-favorite") {
_0x50cf35 += "收藏";
} else {
_0x328a11 === "aliyun-public-share" && (_0x50cf35 += "分享");
}
}
$.log("✅ " + _0x50cf35 + "成功: " + _0x1079a5);
} catch (_0x4308e3) {
this.ckStatus = false;
$.log("⛔️ " + taskType + "失败! " + _0x4308e3);
}
}
async getCsrfToken(_0x14b275, _0x1df5a9) {
try {
const _0x52e8e3 = {
url: "https://developer.aliyun.com/csrfToken",
type: "get",
headers: {
Cookie: this.token,
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 AliApp(Aliyun/6.7.1) WindVane/8.7.2 1170x2532 WK",
Referer: "https://developer.aliyun.com/" + _0x1df5a9 + "/" + _0x14b275
}
},
_0x3bd607 = await this.fetch(_0x52e8e3);
return _0x3bd607?.["token"];
} catch (_0xff950d) {
this.ckStatus = false;
$.log("⛔️ 获取 csrf 失败! " + _0xff950d);
}
}
async voteAnswer(_0x3fbe93, _0x42dac3, _0x537689, _0x265440) {
try {
const _0x10d8f7 = {
url: "https://developer.aliyun.com/developer/api/my/ask/voteAnswer",
type: "post",
dataType: "form",
headers: {
Cookie: this.token,
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 AliApp(Aliyun/6.7.1) WindVane/8.7.2 1170x2532 WK",
Referer: "https://developer.aliyun.com/ask/" + _0x3fbe93
},
params: {
p_csrf: _0x537689
},
body: {
id: _0x42dac3,
votes: _0x265440
}
};
await this.fetch(_0x10d8f7);
$.log("✅ 回答点赞: " + _0x3fbe93 + "-" + _0x42dac3);
} catch (_0x7c5168) {
this.ckStatus = false;
$.log("⛔️ 回答点赞失败! " + _0x7c5168);
}
}
async addBookComment(_0xaf91a2, _0x446dd7) {
try {
const _0x56afc = {
url: "https://developer.aliyun.com/developer/api/ebook/mark/add",
type: "post",
dataType: "json",
headers: {
Cookie: this.token,
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 AliApp(Aliyun/6.7.1) WindVane/8.7.2 1170x2532 WK",
Referer: "https://developer.aliyun.com/ebook/" + _0xaf91a2
},
params: {
p_csrf: _0x446dd7
},
body: {
eBookId: _0xaf91a2,
score: 10,
content: "很棒的一本书"
}
},
_0xabd061 = await this.fetch(_0x56afc);
_0xabd061?.["code"] == "200" ? $.log("✅ 评价电子书: " + _0xaf91a2) : $.log("⛔️ 评价电子书失败! " + _0xabd061?.["message"]);
} catch (_0x29718e) {
this.ckStatus = false;
$.log("⛔️ 评价电子书失败! " + _0x29718e);
}
}
async getFavors() {
try {
const _0x27ff04 = {
url: "https://developer.aliyun.com/developer/api/my/subscribe/listUserFavor",
type: "get",
params: {
pageNum: 1,
pageSize: 10,
type: 1
}
},
_0x44277f = await this.fetch(_0x27ff04),
{
list: _0xa82dd5
} = _0x44277f?.["data"];
if (_0xa82dd5.length) {
$.log("✅ 开始取消文章的点赞与收藏记录");
return _0xa82dd5;
}
return [];
} catch (_0x2ac5df) {
this.ckStatus = false;
$.log("⛔️ " + (type === "aliyun-public-like" ? "文章点赞" : "文章收藏") + "失败! " + _0x2ac5df);
}
}
async addComment(_0x5a69fa) {
try {
const _0x1c933b = {
url: "https://ucc.aliyun.com/uccPagingComponent/addComment",
type: "get",
params: {
content: encodeURIComponent("很有用的文章,非常受用,感谢博主"),
objectId: _0x5a69fa,
bizCategory: "yq-comment-type-article",
commentType: 0,
sourceAppCode: "developer-ecology",
sourceBizCategory: "developer-ecology-group",
uccCsrfToken: await this.getUccCsrfToken(),
callback: getCallback()
}
};
await this.fetch(_0x1c933b);
$.log("✅ 文章评论: " + _0x5a69fa);
} catch (_0x5cc9d4) {
this.ckStatus = false;
$.log("⛔️ 文章点赞失败! " + _0x5cc9d4);
}
}
async doScene() {
const _0x3dd29a = this.token.match(new RegExp("c_csrf=([^;]*)"))[1];
await this.getSceneList();
await $.wait(this.getRandomTime());
const _0x352737 = await this.getSceneDetailPageInfoById();
await $.wait(this.getRandomTime());
_0x352737 ? (await this.getSceneStartPageInfoById(), await $.wait(this.getRandomTime()), this.resourceFrom === "2" ? (await this.startSceneById(_0x3dd29a), await $.wait(this.getRandomTime()), await this.closeSceneById(_0x3dd29a), await $.wait(this.getRandomTime())) : await this.doScene()) : await this.doScene();
}
async getSceneList() {
try {
const _0x41c20d = Math.floor(Math.random() * 26) + 1,
_0x2948af = 21,
_0x33a49d = {
url: "https://developer.aliyun.com/adc/api/getSceneList",
type: "get",
params: {
tags: encodeURIComponent(","),
difficulty: "",
orderBy: "useCountTotal",
pageNum: _0x41c20d,
pageSize: _0x2948af
},
headers: {
Cookie: this.headers.Cookie,
Referer: "https://developer.aliyun.com/adc/labs/",
"User-Agent": this.headers["User-Agent"]
}
},
_0xc4a23 = await this.fetch(_0x33a49d),
_0x2e9bbb = _0xc4a23?.["data"]?.["list"];
if (_0x2e9bbb.length) {
const _0x208b85 = _0x2e9bbb[Math.floor(Math.random() * _0x2e9bbb.length)];
this.sceneId = _0x208b85?.["id"];
$.log("✅ 获取场景: " + _0x208b85.name + "[" + this.sceneId + "]");
} else {
$.log("⛔️ 获取场景失败! " + e);
}
} catch (_0x4fcbc5) {
this.ckStatus = false;
$.log("⛔️ 获取场景失败! " + _0x4fcbc5);
}
}
async getSceneDetailPageInfoById() {
try {
const _0x3da505 = {
url: "https://developer.aliyun.com/adc/api/getSceneDetailPageInfoById",
type: "get",
params: {
id: this.sceneId
},
headers: {
cookie: this.headers.Cookie,
referer: "https://developer.aliyun.com/adc/scenario/" + this.sceneId,
"user-agent": this.headers["User-Agent"]
}
},
_0x28ef4a = await this.fetch(_0x3da505),
_0x497496 = _0x28ef4a?.["data"]?.["developerAdcExperienceStatusVO"]?.["buttonCode"];
return _0x497496 ? _0x497496 === "1" ? ($.log("✅ 确认场景状态: " + _0x28ef4a?.["data"]?.["id"]), _0x28ef4a?.["data"]?.["id"]) : ($.log("⛔️ 确认场景状态: " + _0x28ef4a?.["data"]?.["id"] + " 已完成,将重新获取场景"), null) : ($.log("⛔️ 确认场景状态: " + _0x28ef4a?.["data"]?.["id"] + " 状态异常,将重新获取场景"), null);
} catch (_0x7edf72) {
this.ckStatus = false;
$.log("⛔️ 确认场景状态失败! " + _0x7edf72);
}
}
async getSceneStartPageInfoById() {
try {
const _0x2a5b50 = {
url: "https://developer.aliyun.com/adc/api/getSceneStartPageInfoById",
type: "get",
params: {
id: this.sceneId
},
headers: {
cookie: this.headers.Cookie,
referer: "https://developer.aliyun.com/adc/scenario/exp/" + this.sceneId,
"user-agent": this.headers["User-Agent"]
}
},
_0x994f69 = await this.fetch(_0x2a5b50);
this.ip = _0x994f69?.["data"]?.["ip"];
_0x994f69?.["data"]?.["resourceFrom"]["indexOf"]("1") > -1 ? this.resourceFrom = "1" : this.resourceFrom = "2";
_0x994f69?.["data"]?.["resourceCardInfoDTOList"]["length"] && (this.sectionId = _0x994f69?.["data"]?.["resourceCardInfoDTOList"][0]?.["id"]);
$.log("✅ 获取场景初始化信息: " + this.sceneId);
} catch (_0x1f2d2e) {
this.ckStatus = false;
$.log("⛔️ 获取场景初始化信息失败! " + _0x1f2d2e);
}
}
async startSceneById(_0x3458cc) {
try {
const _0x3b99fa = {
url: "https://developer.aliyun.com/adc/api/startSceneById",
type: "post",
dataType: "form",
headers: {
Host: "developer.aliyun.com",
H_csrf: _0x3458cc,
"X-XSRF-TOKEN": _0x3458cc,
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/adc/scenario/exp/" + this.sceneId
},
params: {
p_csrf: _0x3458cc
},
body: {
id: this.sceneId,
resourceFrom: this.resourceFrom
}
},
_0x3d8839 = await this.fetch(_0x3b99fa),
{
code: _0xc40c1b,
message: _0x4409f8
} = _0x3d8839;
console.log((_0xc40c1b === "200" ? "✅" : "⛔️") + " 开始场景: " + this.sceneId + ", " + _0x4409f8);
} catch (_0x153c26) {
this.ckStatus = false;
$.log("⛔️ 开始场景失败! " + _0x153c26);
}
}
async closeSceneById(_0x15581c) {
try {
const _0x1af2e0 = {
url: "https://developer.aliyun.com/adc/api/closeSceneById",
type: "post",
dataType: "form",
body: {
sceneId: this.sceneId,
forceClose: "true"
},
params: {
p_csrf: _0x15581c
},
headers: {
Host: "developer.aliyun.com",
H_csrf: _0x15581c,
"X-XSRF-TOKEN": _0x15581c,
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/adc/scenario/exp/" + this.sceneId
}
},
_0x51d26a = await this.fetch(_0x1af2e0),
{
code: _0x25c55b,
message: _0x56dd3d
} = _0x51d26a;
console.log((_0x25c55b === "200" ? "✅" : "⛔️") + " 结束场景: " + this.sceneId + ", " + _0x56dd3d);
} catch (_0x1d4966) {
this.ckStatus = false;
$.log("⛔️ 结束场景失败! " + _0x1d4966);
}
}
async createResourceById(_0x834011) {
try {
const _0x41a80d = {
url: "https://developer.aliyun.com/adc/api/createResourceById",
type: "post",
dataType: "form",
body: {
id: this.sceneId,
sectionId: this.sectionId,
ip: this.ip
},
params: {
p_csrf: _0x834011
},
headers: {
Host: "developer.aliyun.com",
H_csrf: _0x834011,
"X-XSRF-TOKEN": _0x834011,
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/adc/scenario/exp/" + this.sceneId
}
},
_0x27cbab = await this.fetch(_0x41a80d);
_0x27cbab?.["data"] && console.log("✅ 开始创建场景资源: " + this.sceneId);
} catch (_0x412567) {
this.ckStatus = false;
$.log("⛔️ 创建场景资源失败! " + _0x412567);
}
}
async getResourceCardInfoById() {
try {
const _0x4997a1 = {
url: "https://developer.aliyun.com/adc/api/getResourceCardInfoById",
type: "get",
params: {
sceneId: this.sceneId,
sectionId: this.sectionId
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/adc/scenario/exp/" + this.sceneId
}
},
_0x495744 = await this.fetch(_0x4997a1),
{
code: _0x311cab,
data: _0x1a5082
} = _0x495744;
if (_0x311cab === "200" && _0x1a5082) {
if (_0x1a5082?.["status"] !== "RUNNING") {
await $.wait(this.getRandomTime());
await this.getResourceCardInfoById();
} else {
console.log("✅ 创建场景资源完毕: " + this.sceneId);
return true;
}
}
} catch (_0x2b5bb8) {
this.ckStatus = false;
$.log("⛔️ 创建场景资源失败! " + _0x2b5bb8);
}
}
async getVideoDetail(_0x4d4d9c) {
try {
const _0x182acd = Date.now(),
_0x3c4b70 = getCallback(_0x182acd),
_0xcad9e0 = {
url: "https://ucc.aliyun.com/api/ucc/live/open/detail",
type: "get",
params: {
_: _0x182acd,
callback: _0x3c4b70,
version: "1.1.23",
id: _0x4d4d9c
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/live/" + _0x4d4d9c
}
},
_0x4fc481 = await this.fetch(_0xcad9e0),
_0x1b9559 = getJson(_0x4fc481),
_0x2d27a2 = _0x1b9559?.["data"]?.["live"]?.["name"],
_0x5999bb = _0x1b9559?.["data"]?.["live"]?.["duration"];
console.log("✅ 获取视频信息成功: " + _0x2d27a2 + ", 时长: " + _0x5999bb + " 秒");
return {
videoName: _0x2d27a2,
videoTime: _0x5999bb
};
} catch (_0x84caed) {
this.ckStatus = false;
$.log("⛔️ 获取视频信息失败! " + _0x84caed);
return null;
}
}
async getVideoView(_0x28cb91, _0x1fbdb6) {
try {
const _0x58383b = Date.now(),
_0x212646 = getCallback(_0x58383b),
_0x52ad1f = {
url: "https://ucc.aliyun.com/api/ucc/live/open/view",
type: "get",
params: {
_: _0x58383b,
callback: _0x212646,
version: "1.1.23",
id: _0x28cb91,
sessionId: _0x1fbdb6
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/live/" + _0x28cb91
}
};
await this.fetch(_0x52ad1f);
} catch (_0x2ab9d3) {
this.ckStatus = false;
$.log("⛔️ 获取视频视图失败! " + _0x2ab9d3);
}
}
async play(_0x5b0846, _0x59c88b, _0x586a5c) {
try {
const _0x41daf1 = Date.now(),
_0x3ceb35 = getCallback(_0x41daf1),
_0x2a6376 = {
url: "https://ucc.aliyun.com/api/ucc/live/open/play",
type: "get",
params: {
_: _0x41daf1,
callback: _0x3ceb35,
version: "1.1.23",
id: _0x59c88b,
sessionId: _0x586a5c
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/live/" + _0x59c88b
}
};
await this.fetch(_0x2a6376);
console.log("✅ 开始播放视频: " + _0x5b0846);
} catch (_0xe68df7) {
this.ckStatus = false;
$.log("⛔️ 播放视频失败! " + _0xe68df7);
}
}
async danmu(_0x122aba, _0x394f20) {
try {
const _0x41f145 = Date.now(),
_0x390528 = getCallback(_0x41f145),
_0x568a06 = {
url: "https://ucc.aliyun.com/api/ucc/live/open/danmu",
type: "get",
params: {
_: _0x41f145,
callback: _0x390528,
version: "1.1.23",
id: _0x122aba,
seek: _0x394f20
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/live/" + _0x122aba
}
},
_0x200cba = await this.fetch(_0x568a06),
_0x1dac19 = getJson(_0x200cba);
console.log("✅ 获取第 " + _0x394f20 + " 秒弹幕: " + JSON.stringify(_0x1dac19?.["data"]));
} catch (_0x21608a) {
this.ckStatus = false;
$.log("⛔️ 获取弹幕失败! " + _0x21608a);
}
}
async online(_0x11a584, _0x489059) {
try {
const _0x46e34c = Date.now(),
_0x119516 = getCallback(_0x46e34c),
_0x46e6d1 = {
url: "https://ucc.aliyun.com/api/ucc/live/open/online",
type: "get",
params: {
_: _0x46e34c,
callback: _0x119516,
version: "1.1.23",
id: _0x11a584,
sessionId: _0x489059
},
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
Cookie: this.token,
Referer: "https://developer.aliyun.com/live/" + _0x11a584
}
};
await this.fetch(_0x46e6d1);
console.log("✅ 在线心跳确认成功");
} catch (_0x35c97a) {
this.ckStatus = false;
$.log("⛔️ 在线心跳确认! " + _0x35c97a);
}
}
async playVideo() {
const _0x4d8dfa = "253842",
_0x4dcf2c = getSessionId(this.token, _0x4d8dfa),
{
videoName: _0x5b35f6,
videoTime: _0x2ea2a0
} = await this.getVideoDetail(_0x4d8dfa);
await $.wait(this.getRandomTime());
await this.getVideoView(_0x4d8dfa, _0x4dcf2c);
await $.wait(this.getRandomTime());
await this.play(_0x5b35f6, _0x4d8dfa, _0x4dcf2c);
await $.wait(this.getRandomTime());
for (let _0x48defa = 3; _0x48defa < _0x2ea2a0; _0x48defa += 3) {
await this.danmu(_0x4d8dfa, _0x48defa);
await $.wait(3000);
_0x48defa == 60 && (await this.online(_0x4d8dfa, _0x4dcf2c));
}
console.log("✅ 视频播放完毕: " + _0x5b35f6);
}
async getGroupItems() {
try {
const _0x2b6d43 = {
url: "/lm/getGroupItems?pageNum=1&pageSize=50",
type: "get"
},
_0x663d6b = await this.fetch(_0x2b6d43),
{
list: _0x541c1b
} = _0x663d6b?.["data"];
if (_0x541c1b.length) {
$.log("✅ 开始查询库存:");
for (let _0x44322e of _0x541c1b) {
$.log("🎁 " + _0x44322e.itemTitle.replace(/【.*?】/g, "") + ": " + _0x44322e.points + " 分【" + _0x44322e.statusStr + "】");
}
}
} catch (_0x5763b6) {
$.log("⛔️ 查询待收获积分列表失败! " + _0x5763b6);