forked from gys619/Thread
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd_beauty_plant.py
executable file
·1000 lines (908 loc) · 50.3 KB
/
jd_beauty_plant.py
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
#!/bin/env python3
# -*- coding: utf-8 -*
'''
感谢Curtin提供的其他脚本供我参考
感谢aburd ch大佬的指导
项目名称:xF_jd_beauty_plant.py
Author: 一风一扬
功能:健康社区-种植园自动任务
Date: 2022-1-4
cron: 10 9,11,15,21 * * * jd_beauty_plant.py
new Env('化妆馆-种植园自动任务');
活动入口:25:/¥2EaeU74Gz07gJ%
教程:该活动与京东的ck通用,所以只需要填写第几个号运行改脚本就行了。
青龙变量填写export plant_cookie="1",代表京东CK的第一个号执行该脚本
多账号用&隔开,例如export plant_cookie="1&2",代表京东CK的第一、二个号执行该脚本。这样做,JD的ck过期就不用维护两次了,所以做出了更新。
青龙变量export choose_plant_id="true",表示自己选用浇水的ID,适用于种植了多个产品的人,默认为false,如果是false仅适用于种植了一个产品的人。
对于多账号的,只要有一个账号种植多个产品,都必须为true才能浇水。如果choose_plant_id="false",planted_id可以不填写变量值。
青龙变量export planted_id = 'xxxx',表示需要浇水的id,单账号可以先填写export planted_id = '111111',export choose_plant_id="true",运行一次脚本
日志输出会有planted_id,然后再重新修改export planted_id = 'xxxxxx'。多个账号也一样,如果2个账号export planted_id = '111111&111111'
3个账号export planted_id = '111111&111111&111111',以此类推。
注意:planted_id和ck位置要对应。而且你有多少个账号,就得填多少个planted_id,首次111111填写时,为6位数。
例如export plant_cookie="xxxx&xxxx&xxx",那export planted_id = "111111&111111&111111",也要写满3个id,这样才能保证所有账号都能跑
https://github.com/jsNO1/e
'''
######################################################以下代码请不要乱改######################################
UserAgent = ''
account = ''
cookie = ''
cookies = []
choose_plant_id = 'false'
planted_id = ''
shop_id = ''
beauty_plant_exchange = 'false'
planted_ids = []
import requests
import time, datetime
import requests, re, os, sys, random, json
from urllib.parse import quote, unquote
import threading
import urllib3
# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
requests.packages.urllib3.disable_warnings ()
today = datetime.datetime.now ().strftime ('%Y-%m-%d')
tomorrow = (datetime.datetime.now () + datetime.timedelta (days=1)).strftime ('%Y-%m-%d')
nowtime = datetime.datetime.now ().strftime ('%Y-%m-%d %H:%M:%S.%f8')
time1 = '21:00:00.00000000'
time2 = '23:00:00.00000000'
flag_time1 = '{} {}'.format (today, time1)
flag_time2 = '{} {}'.format (today, time2)
pwd = os.path.dirname (os.path.abspath (__file__)) + os.sep
path = pwd + "env.sh"
sid = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 32))
sid_ck = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdefABCDEFGHIJKLMNOPQRSTUVWXYZ', 43))
def printT(s):
print ("[{0}]: {1}".format (datetime.datetime.now ().strftime ("%Y-%m-%d %H:%M:%S"), s))
sys.stdout.flush ()
def getEnvs(label):
try:
if label == 'True' or label == 'yes' or label == 'true' or label == 'Yes':
return True
elif label == 'False' or label == 'no' or label == 'false' or label == 'No':
return False
except:
pass
try:
if '.' in label:
return float (label)
elif '&' in label:
return label.split ('&')
elif '@' in label:
return label.split ('@')
else:
return int (label)
except:
return label
# 获取v4环境 特殊处理
try:
with open (v4f, 'r', encoding='utf-8') as v4f:
v4Env = v4f.read ()
r = re.compile (r'^export\s(.*?)=[\'\"]?([\w\.\-@#&=_,\[\]\{\}\(\)]{1,})+[\'\"]{0,1}$',
re.M | re.S | re.I)
r = r.findall (v4Env)
curenv = locals ()
for i in r:
if i[0] != 'JD_COOKIE':
curenv[i[0]] = getEnvs (i[1])
except:
pass
############# 在pycharm测试ql环境用,实际用下面的代码运行 #########
# with open(path, "r+", encoding="utf-8") as f:
# ck = f.read()
# if "JD_COOKIE" in ck:
# r = re.compile (r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I)
# cookies = r.findall (ck)
# # print(cookies)
# # cookies = cookies[0]
# # print(cookies)
# # cookies = cookies.split ('&')
# printT ("已获取并使用ck环境 Cookie")
#######################################################################
if "plant_cookie" in os.environ:
if len (os.environ["plant_cookie"]) == 1:
is_ck = int(os.environ["plant_cookie"])
cookie1 = os.environ["JD_COOKIE"].split('&')
cookie = cookie1[is_ck-1]
printT ("已获取并使用Env环境cookie")
elif len (os.environ["plant_cookie"]) > 1:
cookies1 = []
cookies1 = os.environ["JD_COOKIE"]
cookies1 = cookies1.split ('&')
is_ck = os.environ["plant_cookie"].split('&')
for i in is_ck:
cookies.append(cookies1[int(i)-1])
printT ("已获取并使用Env环境plant_cookies")
else:
printT ("变量plant_cookie未填写")
exit (0)
if "choose_plant_id" in os.environ:
choose_plant_id = os.environ["choose_plant_id"]
printT (f"已获取并使用Env环境choose_plant_id={choose_plant_id}")
else:
printT ("变量choose_plant_id未填写,默认为false只种植了一个,如果种植了多个,请填写改变量planted_id")
if "planted_id" in os.environ:
if len (os.environ["planted_id"]) > 8:
planted_ids = os.environ["planted_id"]
planted_ids = planted_ids.split ('&')
else:
planted_id = os.environ["planted_id"]
printT (f"已获取并使用Env环境planted_id={planted_id}")
else:
printT ("变量planted_id未填写,默认为false只种植了一个,如果种植了多个,请填写改变量planted_id")
if "beauty_plant_exchange" in os.environ:
beauty_plant_exchange = os.environ["beauty_plant_exchange"]
printT (f"已获取并使用Env环境beauty_plant_exchange={beauty_plant_exchange}")
else:
printT ("变量beauty_plant_exchange未填写,默认为false,不用美妆币兑换肥料")
def userAgent():
"""
随机生成一个UA
:return: jdapp;iPhone;9.4.8;14.3;xxxx;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1
"""
if not UserAgent:
uuid = ''.join (random.sample ('123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 40))
addressid = ''.join (random.sample ('1234567898647', 10))
iosVer = ''.join (
random.sample (["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1))
iosV = iosVer.replace ('.', '_')
iPhone = ''.join (random.sample (["8", "9", "10", "11", "12", "13"], 1))
ADID = ''.join (random.sample ('0987654321ABCDEF', 8)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (
random.sample ('0987654321ABCDEF', 4)) + '-' + ''.join (random.sample ('0987654321ABCDEF', 12))
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone{iPhone},1;addressid/{addressid};supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1'
else:
return UserAgent
## 获取通知服务
class msg (object):
def __init__(self, m=''):
self.str_msg = m
self.message ()
def message(self):
global msg_info
printT (self.str_msg)
try:
msg_info = "{}\n{}".format (msg_info, self.str_msg)
except:
msg_info = "{}".format (self.str_msg)
sys.stdout.flush () # 这代码的作用就是刷新缓冲区。
# 当我们打印一些字符时,并不是调用print函数后就立即打印的。一般会先将字符送到缓冲区,然后再打印。
# 这就存在一个问题,如果你想等时间间隔的打印一些字符,但由于缓冲区没满,不会打印。就需要采取一些手段。如每次打印后强行刷新缓冲区。
def getsendNotify(self, a=0):
if a == 0:
a += 1
try:
url = 'https://gitee.com/curtinlv/Public/raw/master/sendNotify.py'
response = requests.get (url)
if 'curtinlv' in response.text:
with open ('sendNotify.py', "w+", encoding="utf-8") as f:
f.write (response.text)
else:
if a < 5:
a += 1
return self.getsendNotify (a)
else:
pass
except:
if a < 5:
a += 1
return self.getsendNotify (a)
else:
pass
def main(self):
global send
cur_path = os.path.abspath (os.path.dirname (__file__))
sys.path.append (cur_path)
if os.path.exists (cur_path + "/sendNotify.py"):
try:
from sendNotify import send
except:
self.getsendNotify ()
try:
from sendNotify import send
except:
printT ("加载通知服务失败~")
else:
self.getsendNotify ()
try:
from sendNotify import send
except:
printT ("加载通知服务失败~")
###################
msg ().main ()
def setName(cookie):
try:
r = re.compile (r"pt_pin=(.*?);") # 指定一个规则:查找pt_pin=与;之前的所有字符,但pt_pin=与;不复制。r"" 的作用是去除转义字符.
userName = r.findall (cookie) # 查找pt_pin=与;之前的所有字符,并复制给r,其中pt_pin=与;不复制。
# print (userName)
userName = unquote (userName[0]) # r.findall(cookie)赋值是list列表,这个赋值为字符串
# print(userName)
return userName
except Exception as e:
print (e, "cookie格式有误!")
exit (2)
# 获取ck
def get_ck(token, sid_ck, account):
try:
url = 'https://api.m.jd.com/client.action?functionId=isvObfuscator'
headers = {
# 'Connection': 'keep-alive',
'accept': '*/*',
"cookie": f"{token}",
'host': 'api.m.jd.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'user-Agent': "JD4iPhone/167922%20(iPhone;%20iOS;%20Scale/2.00)",
'accept-Encoding': 'gzip, deflate, br',
'accept-Language': 'zh-Hans-CN;q=1',
"content-type": "application/x-www-form-urlencoded",
# "content-length":"1348",
}
timestamp = int (round (time.time () * 1000))
timestamp1 = int (timestamp / 1000)
data = r'body=%7B%22url%22%3A%22https%3A%5C/%5C/xinruismzd-isv.isvjcloud.com%22%2C%22id%22%3A%22%22%7D&build=167922&client=apple&clientVersion=10.3.2&d_brand=apple&d_model=iPhone12%2C1&ef=1&eid=eidI4a9081236as4w7JpXa5zRZuwROIEo3ORpcOyassXhjPBIXtrtbjusqCxeW3E1fOtHUlGhZUCur1Q1iocDze1pQ9jBDGfQs8UXxMCTz02fk0RIHpB&ep=%7B%22ciphertype%22%3A5%2C%22cipher%22%3A%7B%22screen%22%3A%22ENS4AtO3EJS%3D%22%2C%22wifiBssid%22%3A%22' + f"{sid_ck}" + r'%3D%22%2C%22osVersion%22%3A%22CJUkCK%3D%3D%22%2C%22area%22%3A%22CJvpCJY1DV80ENY2XzK%3D%22%2C%22openudid%22%3A%22Ytq3YtKyDzO5CJuyZtu4CWSyZtC0Ytc1CJLsDwC5YwO0YtS5CNrsCK%3D%3D%22%2C%22uuid%22%3A%22aQf1ZRdxb2r4ovZ1EJZhcxYlVNZSZz09%22%7D%2C%22ts%22%3A1642002985%2C%22hdid%22%3A%22JM9F1ywUPwflvMIpYPok0tt5k9kW4ArJEU3lfLhxBqw%3D%22%2C%22version%22%3A%221.0.3%22%2C%22appname%22%3A%22com.360buy.jdmobile%22%2C%22ridx%22%3A-1%7D&ext=%7B%22prstate%22%3A%220%22%2C%22pvcStu%22%3A%221%22%7D&isBackground=N&joycious=88&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&partner=apple&rfs=0000&scope=01&sign=946db60626658b250cf47aafb6f67691&st=1642002999847&sv=112&uemps=0-0&uts=0f31TVRjBSu3kkqwe7t25AkQCKuzV3pz8JrojVuU0630g%2BkZigs9kTwRghT26sE72/e92RRKan/%2B9SRjIJYCLuhew91djUwnIY47k31Rwne/U1fOHHr9FmR31X03JKJjwao/EC1gy4fj7PV1Co0ZOjiCMTscFo/8id2r8pCHYMZcaeH3yPTLq1MyFF3o3nkStM/993MbC9zim7imw8b1Fg%3D%3D'
# data = '{"token":"AAFh3ANjADAPSunyKSzXTA-UDxrs3Tn9hoy92x4sWmVB0Kv9ey-gAMEdJaSDWLWtnMX8lqLujBo","source":"01"}'
# print(data)
response = requests.post (url=url, verify=False, headers=headers, data=data)
result = response.json ()
# print(result)
access_token = result['token']
# print(access_token)
return access_token
except Exception as e:
msg ("账号【{0}】获取ck失败,cookie过期".format (account))
# 获取Authorization
def get_Authorization(access_token, account):
try:
url = 'https://xinruimz-isv.isvjcloud.com/papi/auth'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": 'Bearer undefined',
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/logined_jd/',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Origin": "https://xinruimz-isv.isvjcloud.com",
"Content-Type": "application/json;charset=utf-8",
}
data = '{"token":"' + f"{access_token}" + r'","source":"01"}'
# print(data)
response = requests.post (url=url, verify=False, headers=headers, data=data)
result = response.json ()
print (result)
access_token = result['access_token']
access_token = r"Bearer " + access_token
# print(access_token)
return access_token
except Exception as e:
msg ("账号【{0}】获取Authorization失败,cookie过期".format (account))
# 获取已种植的信息
def get_planted_info(cookie, sid, account):
name_list = []
planted_id_list = []
position_list = []
shop_id_list = []
url = 'https://xinruimz-isv.isvjcloud.com/papi/get_home_info'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9'
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
planted_list = result['plant_info']
# print(planted_list)
for i in range (len (planted_list)):
try:
name = result['plant_info'][f'{i + 1}']['data']['name']
planted_id = result['plant_info'][f'{i + 1}']['data']['id']
position = result['plant_info'][f'{i + 1}']['data']['position']
shop_id = result['plant_info'][f'{i + 1}']['data']['shop_id']
# print(name,planted_id,position,shop_id)
name_list.append (name)
planted_id_list.append (planted_id)
position_list.append (position)
shop_id_list.append (shop_id)
print (f"账号{account}种植的种子为", name, "planted_id:", planted_id, ",shop_id:", shop_id)
except Exception as e:
pass
return name_list, position_list, shop_id_list, planted_id_list
# 领取每日水滴
def get_water(cookie, position, sid, account):
try:
j = 0
url = 'https://xinruimz-isv.isvjcloud.com/papi/collect_water'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
for i in position:
data = r'{"position":' + f"{i}" + r'}'
response = requests.post (url=url, verify=False, headers=headers, data=data)
# print(response.status_code)
if response.status_code == 204:
j += 1
total = j * 10
if response.status_code == 204:
msg ("账号【{0}】成功领取每日水滴{1}".format (account, total))
except Exception as e:
msg ("账号【{0}】领取每日水滴失败,可能是cookie过期".format (account))
# 领取每日肥料
def get_fertilizer(cookie, shop_id, account):
try:
j = 0
url = 'https://xinruimz-isv.isvjcloud.com/papi/collect_fertilizer'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
for i in shop_id:
data = r'{"shop_id":' + f"{i}" + r'}'
response = requests.post (url=url, verify=False, headers=headers, data=data)
if response.status_code == 204:
j += 1
total = j * 10
if response.status_code == 204:
msg ("账号【{0}】成功领取每日肥料{1}".format (account, total))
except Exception as e:
msg ("账号【{0}】领取每日肥料失败,可能是cookie过期".format (account))
# 获取任务信息
def get_task(cookie, account):
try:
taskName_list = []
taskId_list = []
taskName_list2 = []
taskId_list2 = []
taskName_list3 = []
taskId_list3 = []
url = 'https://xinruimz-isv.isvjcloud.com/papi/water_task_info'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
task_list = result['shops']
task_list2 = result['meetingplaces']
task_list3 = result['prodcuts'] # 浏览加购
# print(task_list)
for i in range (len (task_list)):
try:
taskName = task_list[i]['name']
taskId = task_list[i]['id']
taskId_list.append (taskId)
taskName_list.append (taskName)
except Exception as e:
print (e)
for i in range (len (task_list2)):
try:
taskName2 = task_list2[i]['name']
taskId2 = task_list2[i]['id']
taskId_list2.append (taskId2)
taskName_list2.append (taskName2)
except Exception as e:
print (e)
for i in range (len (task_list3)):
try:
taskName3 = task_list3[i]['name']
taskId3 = task_list3[i]['id']
taskId_list3.append (taskId3)
taskName_list3.append (taskName3)
except Exception as e:
print (e)
# print(taskName_list,taskId_list,taskName_list2,taskId_list2,taskName_list3,taskId_list3)
return taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3
except Exception as e:
print (e)
message = result['message']
if "非法店铺" in message:
msg ("【账号{0}】种子过期,请重新种植".format (account))
# 获取任务信息
def get_fertilizer_task(cookie, shop_id, account):
try:
# taskName_list = []
# taskId_list = []
taskName_list2 = []
taskId_list2 = []
taskName_list3 = []
taskId_list3 = []
taskName_list4 = []
taskId_list4 = []
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_task_info?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers)
result = response.json ()
# print(result)
# task_list = result['shops']
task_list2 = result['meetingplaces']
task_list3 = result['prodcuts'] # 浏览加购
task_list4 = result['live'] # 浏览直播
# print(task_list)
# for i in range (len (task_list)):
# try:
# taskName = task_list[i]['name']
# taskId = task_list[i]['id']
# taskId_list.append(taskId)
# taskName_list.append(taskName)
# except Exception as e:
# print(e)
for i in range (len (task_list2)):
try:
taskName2 = task_list2[i]['name']
taskId2 = task_list2[i]['id']
taskId_list2.append (taskId2)
taskName_list2.append (taskName2)
except Exception as e:
print (e)
for i in range (len (task_list3)):
try:
taskName3 = task_list3[i]['name']
taskId3 = task_list3[i]['id']
taskId_list3.append (taskId3)
taskName_list3.append (taskName3)
except Exception as e:
print (e)
for i in range (len (task_list4)):
try:
taskName4 = task_list4[i]['name']
taskId4 = task_list4[i]['id']
taskId_list4.append (taskId4)
taskName_list4.append (taskName4)
except Exception as e:
print (e)
# print(taskName_list,taskId_list,taskName_list2,taskId_list2,taskName_list3,taskId_list3)
return taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4
except Exception as e:
print (e)
message = result['message']
if "非法店铺" in message:
msg ("【账号{0}】种子过期,请重新种植".format (account))
# 做任务1
def do_task1(cookie, taskName, taskId, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_shop_view?shop_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览任务【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览任务【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 做浏览任务
def do_task2(cookie, taskName, taskId, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_meetingplace_view?meetingplace_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': 'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id=12&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览任务【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览任务【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 浏览加购
def do_task3(cookie, taskName, taskId, sid, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/water_product_view?product_id={taskId}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览加购【{1}】等待10秒".format (account, taskName))
msg ("账号【{0}】执行浏览加购【{1}】成功,获取【{2}】水滴".format (account, taskName, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览关注
def do_fertilizer_task(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_shop_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
while True:
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【浏览关注】等待10秒".format (account))
msg ("账号【{0}】执行【浏览关注】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览
def do_fertilizer_task2(cookie, name, meetingplace_id, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_meetingplace_view?meetingplace_id={meetingplace_id}&shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览关注{1}等待10秒".format (account, name))
msg ("账号【{0}】执行浏览关注{1}任务成功,获取【{2}】肥料".format (account, name, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-加购
def do_fertilizer_task3(cookie, name, product_id, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_product_view?product_id={product_id}&shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
while True:
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行浏览并加购{1}等待10秒".format (account, name))
msg ("账号【{0}】执行浏览并加购{1}任务成功,获取【{2}】肥料".format (account, name, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-观看其他小样
def do_fertilizer_task4(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_sample_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【观看其他小样】等待10秒".format (account))
msg ("账号【{0}】执行【观看其他小样】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-浏览化妆馆
def do_fertilizer_task5(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_chanel_view?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
print (result)
score = result['inc']
print ("账号【{0}】执行【浏览化妆馆】等待10秒".format (account))
msg ("账号【{0}】执行【浏览化妆馆】任务成功,获取【{1}】肥料".format (account, score))
time.sleep (10)
except Exception as e:
print (e)
time.sleep (1)
# 施肥中的任务-美妆币兑换,每天5次
def do_fertilizer_task6(cookie, shop_id, account):
try:
url = f'https://xinruimz-isv.isvjcloud.com/papi/fertilizer_exchange?shop_id={shop_id}'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
# "Content-Type": "application/json;charset=utf-8",
}
for i in range (5):
response = requests.get (url=url, verify=False, headers=headers) # data中有汉字,需要encode为utf-8
result = response.json ()
# print(result)
score = result['inc']
print ("账号【{0}】【shop_id:{1}】正在【兑换肥料】等待10秒".format (account, shop_id))
msg ("账号【{0}】【shop_id:{2}】执行【兑换肥料】任务成功,获取【{1}】肥料".format (account, score, shop_id))
time.sleep (10)
except Exception as e:
print (e)
msg ("账号【{0}】【shop_id:{1}】肥料兑换已达上限".format (account, shop_id))
time.sleep (1)
# 浇水
def watering(cookie, plant_id, sid, account):
try:
url = 'https://xinruimz-isv.isvjcloud.com/papi/watering'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/?sid={sid}&un_area=19_1655_4866_0',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
data = r'{"plant_id":' + f"{plant_id}" + r'}'
while True:
response = requests.post (url=url, verify=False, headers=headers,
data=data.encode ()) # data中有汉字,需要encode为utf-8
result = response.json ()
# print(result)
level = result['level'] # 当前等级
complete_level = result['complete_level'] # 完成等级
msg ("【账号{0}】【plant_id:{3}】成功浇水10g,当前等级{1},种子成熟等级为{2}".format (account, level, complete_level, plant_id))
time.sleep (5)
except Exception as e:
print(e)
# pass
# 施肥
def fertilization(cookie, plant_id, shop_id, account):
url = 'https://xinruimz-isv.isvjcloud.com/papi/fertilization'
headers = {
'Connection': 'keep-alive',
'Accept': 'application/x.jd-school-raffle.v1+json',
"Authorization": cookie,
'Referer': f'https://xinruimz-isv.isvjcloud.com/plantation/shop_index/?shop_id={shop_id}&channel=index',
'Host': 'xinruimz-isv.isvjcloud.com',
# 'User-Agent': 'jdapp;iPhone;9.4.8;14.3;809409cbd5bb8a0fa8fff41378c1afe91b8075ad;network/wifi;ADID/201EDE7F-5111-49E8-9F0D-CCF9677CD6FE;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/2455696156;supportBestPay/0;appBuild/167629;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
'User-Agent': userAgent (),
# 'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
"Content-Type": "application/json;charset=utf-8",
}
data = r'{"plant_id":' + f"{plant_id}" + r'}'
i = 1
while True:
try:
response = requests.post (url=url, verify=False, headers=headers, data=data) # data中有汉字,需要encode为utf-8
result = response.json ()
# print(result)
level = result['level'] # 当前等级
complete_level = result['complete_level'] # 完成等级
printT ("【账号{0}】【plant_id:{3}】成功施肥10g,当前等级{1},种子成熟等级为{2}".format (account, level, complete_level, plant_id))
time.sleep (5)
i += 1
except Exception as e:
# print(e)
message = result['message']
total = i * 10
if "肥料不足" in message:
msg("【账号{0}】【plant_id:{1}】本次一共施肥{2}g".format (account, plant_id,total))
printT ("【账号{0}】【plant_id:{1}】肥料不足10g".format (account, plant_id))
break
def start():
global cookie, cookies
print (f"\n【准备开始...】\n")
nowtime = datetime.datetime.now ().strftime ('%Y-%m-%d %H:%M:%S.%f8')
if cookie != '':
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3 = get_task (cookie,account)
get_water (cookie, position_list, sid, account)
get_fertilizer (cookie, shop_id_list, account)
for i, j in zip (taskName_list, taskId_list):
do_task1 (cookie, i, j, account)
for i, j in zip (taskName_list2, taskId_list2):
do_task2 (cookie, i, j, account)
for i, j in zip (taskName_list3, taskId_list3):
do_task3 (cookie, i, j, sid, account)
flag = 0
for i in shop_id_list:
do_fertilizer_task (cookie, i, account) # 浏览关注
for k in shop_id_list:
taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4 = get_fertilizer_task (cookie, k, account)
do_fertilizer_task4 (cookie, k, account)
do_fertilizer_task5 (cookie, k, account)
if beauty_plant_exchange == 'true':
do_fertilizer_task6 (cookie, k, account)
for i, j in zip (taskName_list2, taskId_list2):
print (i, j, k)
do_fertilizer_task2 (cookie, i, j, k, account) # 浏览
for i, j in zip (taskName_list3, taskId_list3):
print (i, j, k)
do_fertilizer_task3 (cookie, i, j, k, account) # 加购
if choose_plant_id == 'false':
for i in planted_id_list:
watering (cookie, i, sid, account)
fertilization (cookie, i, k, account)
else:
fertilization (cookie, planted_id_list[flag], k, account)
watering (cookie, planted_id, sid, account)
flag += 1
elif cookies != '':
for cookie, planted_id in zip (cookies, planted_ids):
try:
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
except Exception as e:
pass
for cookie, planted_id in zip (cookies, planted_ids):
try:
account = setName (cookie)
access_token = get_ck (cookie, sid_ck, account)
cookie = get_Authorization (access_token, account)
name_list, position_list, shop_id_list, planted_id_list = get_planted_info (cookie, sid, account)
taskName_list, taskId_list, taskName_list2, taskId_list2, taskName_list3, taskId_list3 = get_task (cookie, account)
get_water (cookie, position_list, sid, account)
get_fertilizer (cookie, shop_id_list, account)
for i, j in zip (taskName_list, taskId_list):
do_task1 (cookie, i, j, account)
for i, j in zip (taskName_list2, taskId_list2):
do_task2 (cookie, i, j, account)
for i, j in zip (taskName_list3, taskId_list3):
do_task3 (cookie, i, j, sid, account)
flag = 0
for i in shop_id_list:
do_fertilizer_task (cookie, i, account) # 浏览关注
for k in shop_id_list:
taskName_list2, taskId_list2, taskName_list3, taskId_list3, taskName_list4, taskId_list4 = get_fertilizer_task (
cookie, k, account)
do_fertilizer_task4 (cookie, k, account)
do_fertilizer_task5 (cookie, k, account)
if beauty_plant_exchange == 'true':
do_fertilizer_task6 (cookie, k, account)
for i, j in zip (taskName_list2, taskId_list2):
print (i, j, k)
do_fertilizer_task2 (cookie, i, j, k, account) # 浏览
for i, j in zip (taskName_list3, taskId_list3):
print (i, j, k)
do_fertilizer_task3 (cookie, i, j, k, account) # 加购
if choose_plant_id == 'false':
for i in planted_id_list:
fertilization (cookie, i, k, account)
watering (cookie, i, sid, account)
else:
print("【账号{}现在开始施肥】".format(account))
fertilization (cookie, planted_id_list[flag], k, account)
print ("【账号{}现在开始浇水】".format (account))
watering (cookie, planted_id, sid, account)
flag += 1
except Exception as e:
pass
else:
printT ("请检查变量plant_cookie是否已填写")
if __name__ == '__main__':
printT ("美丽研究院-种植园")
start ()
# if '成熟' in msg_info:
# send ("美丽研究院-种植园", msg_info)
if '成功' in msg_info:
send ("美丽研究院-种植园", msg_info)