forked from Yiov/wool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jrttjsb.js
1284 lines (1188 loc) · 57.2 KB
/
jrttjsb.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
/*
IOS/安卓: 今日头条极速版
邀请码: 1173836876
老用户每天几毛,新用户可能收益高点
普通版定时: 1-59/15 6-23 * * *
激进版定时: 1-59/5 * * * *
多用户跑的时间会久一点,自己看着改定时吧
自定义UA:捉包拿到自己的UA,填到变量jrttjsbUA里,不填默认用安卓UA
自定义每次运行阅读文章的数量:填到变量jrttjsbReadNum,不填默认10篇
农场和种树任务:默认不做,需要做的,把变量jrttjsbFarm填为1
V2P重写:
[task_local]
#今日头条极速版
1-59/15 6-23 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/jrttjsb.js, tag=今日头条极速版, enabled=true
[rewrite_local]
luckycat\/lite\/v1\/task\/page_data url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/jrttjsb.js
[MITM]
#每个人的域名不同,都放进去MITM吧,还捉不到就自行捉包填写
hostname = *.snssdk.com
hostname = *.toutiaoapi.com
青龙把极速版捉包里面的cookie放到jrttjsbHeader里,多账户用@隔开
*/
const jsname = '今日头条极速版'
const $ = Env(jsname)
const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1
const logDebug = 0
//const notify = $.isNode() ? require('./sendNotify') : '';
let notifyStr = ''
let rndtime = "" //毫秒
let httpResult //global buffer
let host = 'i.snssdk.com'
let hostname = 'https://' + host
let userAgent = ($.isNode() ? process.env.jrttjsbUA : $.getdata('jrttjsbUA')) || 'Dalvik/2.1.0 (Linux; U; Android 7.1.2; VOG-AL10 Build/HUAWEIVOG-AL10) NewsArticle/8.2.8 tt-ok/3.10.0.2';
let userAgentArr = []
let userHeader = ($.isNode() ? process.env.jrttjsbHeader : $.getdata('jrttjsbHeader')) || '';
let userHeaderArr = []
let jrttjsbFarm = ($.isNode() ? process.env.jrttjsbFarm : $.getdata('jrttjsbFarm')) || 0;
let userIdx = 0
let UAcount = 0
let userStatus = []
let maxReadPerRun = ($.isNode() ? process.env.jrttjsbReadNum : $.getdata('jrttjsbReadNum')) || 10;
let readList = []
let validList = []
let adIdList = [26, 181, 186, 187, 188, 189, 190, 195, 210, 214, 216, 225, 308, 324, 327, 329]
///////////////////////////////////////////////////////////////////
!(async () => {
if(typeof $request !== "undefined")
{
await GetRewrite()
}
else
{
await showUpdateMsg()
if(!(await checkEnv())) {
return
}
await initAccountInfo()
await RunMultiUser()
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
function showUpdateMsg() {
console.log('\n2021.12.15 9:30 更新:增加推送奖励,修复一个UA的bug,更改默认UA为安卓\n')
}
//通知
async function showmsg() {
notifyBody = jsname + "运行通知\n\n" + notifyStr
if (notifyFlag != 1) {
console.log(notifyBody);
}
if (notifyFlag == 1) {
$.msg(notifyBody);
//if ($.isNode()){await notify.sendNotify($.name, notifyBody );}
}
}
async function GetRewrite() {
if($request.url.indexOf('luckycat/lite/v1/task/page_data') > -1) {
let userCK = $request.headers.Cookie
if(userHeader) {
if(userHeader.indexOf(userCK) == -1) {
userHeader = userHeader + '@' + userCK
$.setdata(userHeader, 'jrttjsbHeader');
ckList = userHeader.split('@')
$.msg(jsname+` 获取第${ckList.length}个jrttjsbHeader成功: ${userCK}`)
}
} else {
$.setdata(userCK, 'jrttjsbHeader');
$.msg(jsname+` 获取第1个jrttjsbHeader成功: ${userCK}`)
}
}
}
async function checkEnv() {
if(userHeader) {
userHeaderArr = userHeader.split('@')
} else {
console.log('未找到jrttjsbHeader')
return false
}
if(userHeaderArr.length == 0) {
console.log('未找到有效的jrttjsbHeader')
return false
}
if(userAgent) {
userAgentArr = userAgent.split('@')
} else {
console.log('未找到userAgent')
return false
}
UAcount = userAgentArr.length
console.log(`共找到${userHeaderArr.length}个用户,${UAcount}个UA`)
return true
}
async function initAccountInfo() {
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
userStatus.push(true)
}
}
async function RunMultiUser() {
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
//任务页
await QueryUserInfo(1)
if(userStatus[userIdx]==true) {
await GetNewTabs()
await QuerySleepStatus()
await QueryWalkInfo()
await DoneEat()
for(let adId of adIdList) await ExcitationAd(adId)
//console.log(validList)
}
}
await ReadArticles()
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
if(userStatus[userIdx]==true) await QueryUserInfo(0)
}
if(jrttjsbFarm) {
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
if(userStatus[userIdx]==true) {
//农场
//await EnterFarm()
//await $.wait(1500)
await QueryFarmThreeGift()
await QueryFarmInfo()
await QueryFarmLandStatus()
await QueryFarmSignStatus()
await QueryFarmTask()
//种树
await QueryTreeChallenge()
await QueryTreeSignStatus()
await QueryTreeThreeGift()
await QueryTreeWaterTask()
await QueryTreeStatus()
}
}
}
}
//阅读列表
async function ListArts() {
let caller = printCaller()
let url = `${hostname}/api/news/feed/v64/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.message=='success') {
for(let item of result.data) {
let content = JSON.parse(item.content)
if(content.group_id) {
readList.push(content.group_id)
}
}
} else {
console.log(`获取阅读列表失败:${result.message}`)
}
}
//阅读文章
async function ReadArticles() {
console.log(`\n开始阅读,将会阅读${maxReadPerRun}篇文章`)
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
if(userStatus[userIdx]==true) {
await ReadDouble()
await DailyArtsReward()
await DailyPushReward()
}
}
for(let i=0; i<maxReadPerRun; i++) {
let readFlag = 0
for(userIdx=0; userIdx<userHeaderArr.length; userIdx++) {
if(userStatus[userIdx]==true) {
await ReadArtsReward()
readFlag = 1
}
}
if(readFlag ==1 && i<maxReadPerRun-1) {
console.log('等待15秒阅读下一篇...')
await $.wait(15100)
}
}
}
//阅读文章奖励
async function ReadArtsReward() {
let caller = printCaller()
let rndGroupId = Math.floor(Math.random()*7000000000000000000)
let url = `${hostname}/luckycat/lite/v1/activity/done_whole_scene_task/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone`
let body = `{"is_golden_egg":false,"scene_key":"article_detail","group_id":"${rndGroupId}"}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
console.log(`用户${userIdx+1}阅读文章获得${result.data.score_amount}金币,今日阅读总收入:${result.data.total_score_amount}金币`)
} else {
console.log(`用户${userIdx+1}阅读文章失败:${result.err_tips}`)
}
}
//每日阅读奖励
async function DailyArtsReward() {
let caller = printCaller()
let rndGroupId = Math.floor(Math.random()*7000000000000000000)
let url = `${hostname}/score_task/v1/task/get_read_bonus/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone&group_id=${rndGroupId}`
let urlObject = populatePostUrl(url)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
console.log(`用户${userIdx+1}领取每日阅读奖励获得${result.data.score_amount}金币`)
} else {
console.log(`用户${userIdx+1}领取每日阅读奖励失败:${result.err_tips}`)
}
}
//每日推送奖励
async function DailyPushReward() {
let caller = printCaller()
let timeInMS = Math.round(new Date().getTime())
let rndGroupId = Math.floor(Math.random()*7000000000000000000)
let url = `${hostname}/score_task/v1/task/get_read_bonus/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone&group_id=${rndGroupId}&impression_type=push`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
console.log(`用户${userIdx+1}领取每日推送奖励获得${result.data.score_amount}金币`)
} else {
console.log(`用户${userIdx+1}领取每日推送奖励失败:${result.err_tips}`)
}
}
//阅读翻倍
async function ReadDouble() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/activity/double_whole_scene_task/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone`
let body = `{}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
console.log(`用户${userIdx+1}阅读翻倍成功`)
} else {
console.log(`用户${userIdx+1}阅读翻倍:${result.err_tips}`)
}
}
async function GetNewTabs() {
let caller = printCaller()
let url = `${hostname}/score_task/v1/user/new_tabs/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
for(let item of result.data.section) {
if(item.key == 'mine_input_code') {
await PostInviteCode()
break
}
}
}
}
async function PostInviteCode() {
let caller = printCaller()
let body = `{"invitecode" : "1173836876"}`
let url = `${hostname}/luckycat/lite/v1/invite/post_invite_code/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
}
//金币收入
async function QueryCoinInfo() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/user/profit_detail/?offset=0&num=100&income_type=2&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(result.data.score_income_list)
} else {
console.log(`用户${userIdx+1}查询金币收入失败:${result.err_tips}`)
}
}
//查询用户信息,任务状态
async function QueryUserInfo(doTask) {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/task/page_data/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
if(!result.data.treasure) {
userStatus[userIdx] = false
console.log(`用户${userIdx+1}查询状态失败,CK失效`)
return;
}
if(doTask==0) {
console.log(`\n账户信息:`)
console.log(`金币:${result.data.user_income.score_balance}`)
console.log(`现金:${result.data.user_income.cash_balance/100}元`)
} else {
if(result.data.treasure.next_treasure_time == result.data.treasure.current_time) {
await OpenTreasureBox()
} else {
let cdTime = result.data.treasure.next_treasure_time - result.data.treasure.current_time
console.log(`用户${userIdx+1}开宝箱冷却时间还有${cdTime}秒`)
}
if(result.data.signin_detail.today_signed == false) {
await SignIn()
} else {
console.log(`用户${userIdx+1}今天已签到`)
}
}
} else {
console.log(`用户${userIdx+1}查询状态失败:${result.err_tips}`)
}
}
//签到
async function SignIn() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/sign_in/action?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populatePostUrl(url)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no==0) {
console.log(`用户${userIdx+1}签到成功,获得${result.data.score_amount}金币,已连续签到${result.data.sign_times}天`)
} else {
console.log(`用户${userIdx+1}签到失败:${result.err_tips}`)
}
}
//开宝箱
async function OpenTreasureBox() {
let caller = printCaller()
let timeInMS = Math.round(new Date().getTime())
let url = `${hostname}/score_task/v1/task/open_treasure_box/?os_api=25&device_type=VOG-AL10&ssmix=a&manifest_version_code=8280&dpi=240&abflag=3&pass_through=default&cookie_data=JS9ij2PS3AwsrLXtsMlBmg&use_ecpm=0&act_hash=33e5c7c6eceed48faa09bcb731f9cbfe&rom_version=25&rit=coin&app_name=news_article_lite&ab_client=a1%2Ce1%2Cf2%2Cg2%2Cf7&version_name=8.2.8&ab_version=1859936%2C668908%2C3491714%2C668907%2C3491710%2C668905%2C3491678%2C668906%2C3491686%2C668904%2C3491669%2C668903%2C3491704%2C3269751%2C3472846%2C3493942&plugin_state=7731332411413&sa_enable=0&ac=wifi&_request_from=web&update_version_code=82809&channel=lite2_tengxun&_rticket=${timeInMS}&status_bar_height=24&cookie_base=-1E_P8je5Sub5zWkBKiqODt2MECOGuxlsxp2J8N2wuHiAln1gxRIlq9T45zO7j1Y4RwJPfwnZaGcZ871TDjPVA&dq_param=0&device_platform=android&iid=1592553870724568&scm_build_version=1.0.0.1454&mac_address=88%3AB1%3A11%3A61%3A96%3A7B&version_code=828&polaris_version=1.0.5&tma_jssdk_version=1.95.0.28&cdid=19f86713-d4cf-49ea-81ab-541aa5cd7b44&is_pad=1&openudid=711ca30d9d3c10b7&device_id=809664500489800&resolution=720*1280&act_token=0WoqgcXrIdM-iXg179hjJOCBPav6mHf3Biw-ElFmYqvWQIsvoERPbrbEItIYJDJkjXW4NPai8DqYMlLQypO_eQ&os_version=7.1.2&language=zh&device_brand=HUAWEI&aid=35&ab_feature=z1&luckycat_version_name=4.2.0-rc.5&luckycat_version_code=420005`
let body = `{"open_treasure_box_enter_from":"","rit":"coin","use_ecpm":0}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}开宝箱获得${result.data.score_amount}金币`)
} else {
console.log(`用户${userIdx+1}开宝箱失败:${result.err_tips}`)
}
}
//宝箱视频奖励
async function ExcitationAd(task_id) {
let caller = printCaller()
let timeInMS = Math.round(new Date().getTime())
let url = `${hostname}/luckycat/lite/v1/task/done/excitation_ad?os_api=25&device_type=VOG-AL10&ssmix=a&manifest_version_code=8280&dpi=240&abflag=3&pass_through=default&cookie_data=JS9ij2PS3AwsrLXtsMlBmg&act_hash=33e5c7c6eceed48faa09bcb731f9cbfe&rom_version=25&app_name=news_article_lite&ab_client=a1%2Ce1%2Cf2%2Cg2%2Cf7&version_name=8.2.8&ab_version=1859936%2C668908%2C3491714%2C668907%2C3491710%2C668905%2C3491678%2C668906%2C3491686%2C668904%2C3491669%2C668903%2C3491704%2C3269751%2C3472846%2C3493942&plugin_state=7731332411413&sa_enable=0&ac=wifi&_request_from=web&update_version_code=82809&channel=lite2_tengxun&_rticket=${timeInMS}&status_bar_height=24&cookie_base=-1E_P8je5Sub5zWkBKiqODt2MECOGuxlsxp2J8N2wuHiAln1gxRIlq9T45zO7j1Y4RwJPfwnZaGcZ871TDjPVA&dq_param=0&device_platform=android&iid=1592553870724568&scm_build_version=1.0.0.1454&mac_address=88%3AB1%3A11%3A61%3A96%3A7B&version_code=828&polaris_version=1.0.5&tma_jssdk_version=1.95.0.28&cdid=19f86713-d4cf-49ea-81ab-541aa5cd7b44&is_pad=1&openudid=711ca30d9d3c10b7&device_id=809664500489800&resolution=720*1280&act_token=0WoqgcXrIdM-iXg179hjJOCBPav6mHf3Biw-ElFmYqvWQIsvoERPbrbEItIYJDJkjXW4NPai8DqYMlLQypO_eQ&os_version=7.1.2&language=zh&device_brand=HUAWEI&aid=35&ab_feature=z1&luckycat_version_name=4.2.0-rc.5&luckycat_version_code=420005`
let body = `{"ad_alias_position":"coin","task_key":"excitation_ad", "task_id" : "${task_id}"}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}看视频任务[${task_id}]获得${result.data.score_amount}金币`)
//validList.push(task_id)
} else {
console.log(`用户${userIdx+1}看视频任务[${task_id}]失败:${result.err_tips}`)
//if(result.err_tips != '网络错误') validList.push(task_id)
}
}
//查询走路状态
async function QueryWalkInfo() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/walk/page_data/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
if(result.data.can_get_amount > 0) await GetWalkBonus()
} else {
console.log(`用户${userIdx+1}走路状态失败:${result.err_tips}`)
}
}
//走路奖励
async function GetWalkBonus() {
let caller = printCaller()
let nowtime = Math.round(new Date().getTime()/1000)
let url = `${hostname}/luckycat/lite/v1/walk/bonus/?aid=35&update_version_code=85221&os_version=15.0&device_platform=iphone`
let body = `{"task_id":136,"enable_preload_exciting_video":0,"client_time":${nowtime},"rit":"","use_ecpm":0}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}领取走路奖励获得${result.data.score_amount}金币`)
} else {
console.log(`用户${userIdx+1}领取走路奖励失败:${result.err_tips}`)
}
}
//吃饭补贴
async function DoneEat() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/eat/done_eat/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populatePostUrl(url)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}领取吃饭补贴获得${result.data.score_amount}金币`)
} else {
console.log(`用户${userIdx+1}领取吃饭补贴失败:${result.err_tips}`)
}
}
//睡觉状态
async function QuerySleepStatus() {
let caller = printCaller()
let curTime = new Date()
let curHour = curTime.getHours()
let url = `${hostname}/luckycat/lite/v1/sleep/status/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
let sleepHour = Math.floor(result.data.sleep_last_time/36)/100
if(result.data.sleeping == true) {
if(sleepHour>=12) {
await SleepStop()
} else if(result.data.sleep_unexchanged_score==result.data.max_coin && curHour >= 7) {
let rnd = Math.random()
if(rnd>0.95) {
await SleepStop()
} else {
console.log(`用户${userIdx+1}随机醒来时间,本次不进行醒来,已经睡了${sleepHour}小时,可以获得${result.data.sleep_unexchanged_score}金币`)
}
} else {
console.log(`用户${userIdx+1}睡眠中,已经睡了${sleepHour}小时,可以获得${result.data.sleep_unexchanged_score}金币,上限${result.data.max_coin}金币`)
}
} else {
if(result.data.history_amount > 0) {
await SleepDone(result.data.history_amount)
}
if(curHour >= 22 || curHour < 2) {
await SleepStart()
} else if(curHour >= 20) {
let rnd = Math.random()
if(rnd>0.95) {
await SleepStart()
} else {
console.log(`用户${userIdx+1}随机睡眠时间,本次不进行睡眠`)
}
} else {
console.log(`用户${userIdx+1}未到睡觉时间`)
}
}
} else {
console.log(`用户${userIdx+1}查询睡觉状态失败:${result.err_tips}`)
}
}
//睡觉醒来
async function SleepStop() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/sleep/stop/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populatePostUrl(url)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
let sleepHour = result.data.sleep_last_time/3600
console.log(`用户${userIdx+1}结束睡眠,本次睡了${sleepHour}小时,可以领取${result.data.history_amount}金币`)
await SleepDone(result.data.history_amount)
} else {
console.log(`用户${userIdx+1}结束睡眠失败:${result.err_tips}`)
}
}
//睡觉收金币
async function SleepDone(amount) {
let caller = printCaller()
let timeInMS = Math.round(new Date().getTime())
let url = `${hostname}/luckycat/lite/v1/sleep/done_task/?os_api=25&device_type=VOG-AL10&ssmix=a&manifest_version_code=8280&dpi=240&abflag=3&pass_through=default&use_ecpm=0&rom_version=25&rit=coin&app_name=news_article_lite&ab_client=a1%2Ce1%2Cf2%2Cg2%2Cf7&version_name=8.2.8&ab_version=668903%2C3491704%2C1859936%2C668908%2C3491714%2C668907%2C3491710%2C668905%2C3491678%2C668906%2C3491686%2C668904%2C3491669%2C3269751%2C3472846%2C3493942&plugin_state=7731332411413&sa_enable=0&ac=wifi&_request_from=web&update_version_code=82809&channel=lite2_tengxun&_rticket=${timeInMS}&status_bar_height=24&dq_param=0&device_platform=android&iid=1592553870724568&scm_build_version=1.0.0.1454&mac_address=88%3AB1%3A11%3A61%3A96%3A7B&version_code=828&polaris_version=1.0.5&tma_jssdk_version=1.95.0.28&is_pad=1&resolution=720*1280&os_version=7.1.2&language=zh&device_brand=HUAWEI&aid=35&ab_feature=z1&luckycat_version_name=4.2.0-rc.5&luckycat_version_code=420005`
let body = `{"score_amount":${amount},"enable_preload_exciting_video":0}`
let urlObject = populatePostUrl(url,body)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}领取睡觉金币奖励${amount}金币成功`)
} else {
console.log(`用户${userIdx+1}领取睡觉金币奖励失败:${result.err_tips}`)
}
}
//开始睡觉
async function SleepStart() {
let caller = printCaller()
let url = `${hostname}/luckycat/lite/v1/sleep/start/?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populatePostUrl(url)
await httpPost(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.err_no == 0) {
console.log(`用户${userIdx+1}开始睡觉,ZZZzzz...`)
await SleepDone(result.data.history_amount)
} else {
console.log(`用户${userIdx+1}开始睡觉失败:${result.err_tips}`)
}
}
//查询农场状态
async function QueryFarmInfo() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/polling_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
if(result.data.info.offline_production) {
await FarmOfflineDouble()
}
if(result.data.info.water>=10) {
await FarmWater()
}
if(result.data.info.box_num>0) {
await FarmOpenBox()
}
} else {
console.log(`用户${userIdx+1}查询农场状态失败:${result.message}`)
}
}
//进入农场
async function EnterFarm() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/home_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
console.log(result)
if(result.status_code == 0) {
} else {
console.log(`用户${userIdx+1}进入农场失败:${result.message}`)
}
}
//农场-离线奖励翻倍
async function FarmOfflineDouble() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/double_reward?watch_ad=1&aid=35`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}农场离线产量翻倍成功`)
} else {
console.log(`用户${userIdx+1}农场离线产量翻倍失败:${result.message}`)
}
}
//农场-领取三餐礼包
async function RewardFarmThreeGift(gift_id) {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/reward/gift?game_client_version_code=2&gift_id=${gift_id}&watch_ad=0&double=0&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}领取农场三餐礼包获得${result.data.reward_num}水滴`)
} else {
console.log(`用户${userIdx+1}领取农场三餐礼包失败:${result.message}`)
}
}
//农场-三餐礼包状态
async function QueryFarmThreeGift() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/gift/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
for(let item of result.data) {
if(item.status==1) {
await RewardFarmThreeGift(item.gift_id)
}
}
} else {
console.log(`用户${userIdx+1}查询农场三餐礼包状态失败:${result.message}`)
}
}
//查询农场任务列表
async function QueryFarmTask() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/daily_task/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
for(let item of result.data) {
if(item.status==1) {
await RewardFarmTask(item.task_id)
}
}
} else {
console.log(`用户${userIdx+1}查询农场任务列表失败:${result.message}`)
}
}
//农场-领取任务奖励
async function RewardFarmTask(id) {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/reward/task?task_id=${id}&aid=35`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
let typeStr = (result.data.reward_type==1) ? '水滴' : '化肥'
console.log(`用户${userIdx+1}领取农场任务奖励[task_id=${result.data.task_id}]获得${result.data.reward_num}${typeStr},剩余${typeStr}数量${result.data.current_num}`)
} else {
console.log(`用户${userIdx+1}领取农场任务奖励失败:${result.message}`)
}
}
//农场-浇水
async function FarmWater() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/land_water?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}农场浇水成功,剩余水滴:${result.data.water}`)
if(result.data.water>=10) {
await $.wait(1500) //min time 1000
await FarmWater()
}
} else {
console.log(`用户${userIdx+1}农场浇水失败:${result.message}`)
}
}
//农场-开宝箱
async function FarmOpenBox() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/box/open?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}开农场宝箱获得${result.data.incr_coin}金币`)
if(result.data.excitation_ad_score_amount>0) await FarmOpenBoxVideo()
} else {
console.log(`用户${userIdx+1}开农场宝箱失败:${result.message}`)
}
}
//农场-宝箱视频
async function FarmOpenBoxVideo() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/excitation_ad/add?excitation_ad_score_amount=134&device_id=2392172203611735&aid=35&os_version=15.0&update_version_code=85221`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}看农场宝箱视频获得${result.data.incr_coin}金币`)
} else {
console.log(`用户${userIdx+1}看农场宝箱视频失败:${result.message}`)
}
}
//农场-签到状态
async function QueryFarmSignStatus() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/sign_in/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
for(let item of result.data.sign) {
if(item.status==1) {
await FarmSign()
break
}
}
} else {
console.log(`用户${userIdx+1}查询签到状态失败:${result.message}`)
}
}
//农场-签到
async function FarmSign() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/reward/sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
let str = (result.data.reward_type==1)?'水滴':'化肥'
console.log(`用户${userIdx+1}签到获得${result.data.reward_num}${str},剩余${str}数量${result.data.cur_reward_num}`)
} else {
console.log(`用户${userIdx+1}签到失败:${result.message}`)
}
}
//农场-签到视频翻倍
async function FarmSignDouble() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/reward/double_sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
let str = (result.data.reward_type==1)?'水滴':'化肥'
console.log(`用户${userIdx+1}签到翻倍获得${result.data.reward_num}{str},剩余${str}数量${result.data.cur_reward_num}`)
} else {
console.log(`用户${userIdx+1}签到翻倍失败:${result.message}`)
}
}
//农场-土地状态
async function QueryFarmLandStatus() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/home_info?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
for(let item of result.data.info.lands) {
if(item.status==false && item.unlock_able==true) {
await FarmUnlock(item.land_id)
break
}
}
} else {
console.log(`用户${userIdx+1}查询土地状态失败:${result.message}`)
}
}
//农场-土地解锁
async function FarmUnlock(land_id) {
let caller = printCaller()
let url = `${hostname}/ttgame/game_farm/land/unlock?land_id=${land_id}&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}解锁${land_id}号土地成功`)
} else {
console.log(`用户${userIdx+1}解锁${land_id}号土地失败:${result.message}`)
}
}
//种树-签到状态
async function QueryTreeSignStatus() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/sign_in/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
if(result.data.today == false) {
await TreeSign()
}
} else {
console.log(`用户${userIdx+1}查询种树签到状态失败:${result.message}`)
}
}
//种树-签到
async function TreeSign() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/sign_in/reward?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}种树签到获得${result.data.reward_item.num}${result.data.reward_item.name}`)
} else {
console.log(`用户${userIdx+1}种树签到失败:${result.message}`)
}
}
//种树-二选一-选项
async function QueryTreeChallenge() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/challenge/list?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
let bestChoice = 0
let maxWater = 0
for(let item of result.data.tasks) {
if(item.state==0 && item.water_times>maxWater) {
maxWater = item.water_times
bestChoice = item.id
}
}
if(bestChoice>0) await TreeChallengeChoose(bestChoice)
} else {
console.log(`用户${userIdx+1}查询挑战任务失败:${result.message}`)
}
}
//种树-二选一-选择
async function TreeChallengeChoose(id) {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/challenge/choose?task_id=${id}&aid=35`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}选择浇水${result.data.red_point.times}次挑战`)
} else {
console.log(`用户${userIdx+1}选择浇水挑战失败:${result.message}`)
}
}
//种树-二选一-领奖
async function TreeChallengeReward() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/challenge/reward?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}领取浇水挑战奖励获得${result.data.reward_item.num}水滴`)
} else {
console.log(`用户${userIdx+1}领取浇水挑战奖励失败:${result.message}`)
}
}
//种树-化肥签到
async function TreeNutrientSign() {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/nutrient/sign_in?aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
if(result.data.is_rewarded==true) {
console.log(`用户${userIdx+1}种树化肥签到获得${result.data.reward_item.num}{result.data.reward_item.name}`)
} else {
console.log(`用户${userIdx+1}种树化肥签到成功`)
}
} else {
console.log(`用户${userIdx+1}种树化肥签到失败:${result.message}`)
}
}
//种树-领取三餐礼包
async function RewardTreeThreeGift(task_id) {
let caller = printCaller()
let url = `${hostname}/ttgame/game_orchard/three_gift/reward?task_id=${task_id}&watch_ad=0&extra_ad_num=0&aid=35&update_version_code=85221&device_platform=iphone&&device_type=iPhone13,2`
let urlObject = populateGetUrl(url)
await httpGet(urlObject,caller)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.status_code == 0) {
console.log(`用户${userIdx+1}领取种树三餐礼包获得${result.data.reward_item.num}${result.data.reward_item.name}`)
} else {
console.log(`用户${userIdx+1}领取种树三餐礼包失败:${result.message}`)
}
}
//种树-三餐礼包状态
async function QueryTreeThreeGift() {
let caller = printCaller()