-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy path胖乖生活.py
1074 lines (1010 loc) · 45.5 KB
/
胖乖生活.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
"""
* 胖乖生活
* 设置变量 PGSH_TOKEN,多号使用&隔开,青龙直接新建变量即可
* ck格式1:token#备注
* ck格式2: token
* 代理开关变量名:pg_dl,True为开启代理模式,False为关闭,默认为False
* 代理变量名:pg_dlurl,代理地址是动态代理api接口,一次性提取一个,选择txt格式,\r\n或者\n模式都可以
* 并发开关变量名:pg_bf,True为开启并发模式,False为关闭,默认为False
* 并发数量变量名:pg_bfsum,并发几个就写几个,默认为3
* 推送开关变量名:pg_ts,True为开启推送,False为关闭,默认为False
* 推送变量名1:WxPusher:pg_WxPusher_token是你的WxPusher的推送组的token,pg_WxPusher_uid是你的WxPusher该推送组的用户uid,推送给谁就填写谁的,填写一个即可
* 推送变量名2:pushplus:pg_pushplus_token是你的pushplus的token
* Top: 上面两个推送配置哪个就使用哪个推送,两个都配置的话就两个都进行推送
* 数据库地址变量名:pg_ckurl,保证打开数据库里面是ck,并使用&隔开,或者ck#备注,并使用&隔开
* 不填备注默认使用隐私格式手机号作为用户名,否则使用填写的备注作为用户名
* 出现False就是任务已完成或者不可完成
* 推荐携趣,注册实名每天免费1k,地址:https://www.xiequ.cn/
* cron:0 * * * * 务必使用此cron,无需担心黑号
"""
##############################
ck = "" # 本地环境ck,环境变量存在此处不生效
ckurl1 = "" # 数据库地址,适配部分群友要求
jh = False # 聚合ck模式,开启即所有环境模式ck都生效,都会合成为一个ck列表,关闭则优先处理环境变量,默认为True,False为关闭
#############################
# -----运行模式配置区,自行配置------
bf1 = False # True开启并发,False关闭并发
bfsum1 = 3 # 并发数,开启并发模式生效
# -------推送配置区,自行填写-------
ts1 = False # True开启推送,False关闭推送
# -------代理配置区,自行填写-------
dl1 = False # True开启代理,False关闭代理
dl_url = "" # 代理池api
# -----代理时间配置区,秒为单位------
dl_sleep = 30 # 代理切换时间
qqtime = 6 # 请求超时时间
# -----时间配置区,默认即可------
a = "6"
b = "22" # 表示6-22点之间才执行任务
#############################
# ---------勿动区----------
# 已隐藏乾坤于此区域
###########################
# ---------代码块---------
import requests
import time
import random
import string
import os
import json
import hashlib
import threading
from functools import partial
from urllib.parse import urlparse
from datetime import datetime, timedelta
from concurrent.futures import ThreadPoolExecutor, as_completed
from urllib3.exceptions import InsecureRequestWarning
dl = os.environ.get('pg_dl', dl1)
proxy_api_url = os.environ.get('pg_dlurl', dl_url)
bf = os.environ.get('pg_bf', bf1)
bfsum = os.environ.get('pg_bfsum', bfsum1)
ts = os.environ.get('pg_ts', ts1)
ckurl = os.environ.get('pg_ckurl', ckurl1)
WxPusher_uid = os.environ.get('pg_WxPusher_uid')
WxPusher_token = os.environ.get('pg_WxPusher_token')
pushplus_token = os.environ.get('pg_pushplus_token')
# def check_yl():
# lb = ['requests', 'urllib3']
# for yl in lb:
# try:
# subprocess.check_call(["pip", "show", yl], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# except subprocess.CalledProcessError:
# print(f"{yl} 未安装,开始安装...")
# subprocess.check_call(["pip", "install", yl, "-i", "https://pypi.tuna.tsinghua.edu.cn/simple"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# print(f"{yl} 安装完成")
# check_yl()
v = '9.9.9.'
global_proxy = {
'http': None,
'https': None
}
def start_dlapi():
dlstart = threading.Thread(target=get_proxy, args=(stop_event,))
dlstart.start()
stop_event = threading.Event()
def get_proxy(stop_event):
global global_proxy, ipp
a = 0
while not stop_event.is_set():
a += 1
response = requests.get(proxy_api_url)
if response.status_code == 200:
proxy1 = response.text.strip()
if "白名单" not in proxy1:
print(f'✅第{a}次获取代理成功: {proxy1}')
ipp = proxy1.split(':')[0]
global_proxy = {
'http': proxy1,
'https': proxy1,
}
start_time = time.time()
while time.time() - start_time < dl_sleep:
if ip():
print("✅代理检测通过,可以使用")
time.sleep(2)
else:
print(f'❎当前ip不可用,第{a}次重新获取!')
break
continue
else:
print(f"请求代理池: {proxy1}")
print("响应中存在白名单字样,结束运行")
os._exit(0)
else:
print(f'❎第{a}次获取代理失败!重新获取!')
time.sleep(dl_sleep)
continue
def ip():
try:
if global_proxy:
r = requests.get('http://httpbin.org/ip', proxies=global_proxy, timeout=10, verify=False)
else:
r = requests.get('http://httpbin.org/ip')
if r.status_code == 200:
ip = r.json()["origin"]
print(f"当前IP: {ip}")
return ip
else:
print(f"❎查询ip失败")
return None
except requests.RequestException as e:
print(f"❎查询ip错误")
return None
except Exception as e:
print(f"❎查询ip错误")
return None
def p(p):
if len(p) == 11:
return p[:3] + '****' + p[7:]
else:
return p
class PGSH:
def __init__(self, cki):
self.msg = None
self.messages = []
self.title = None
self.phone = None
self.token = cki.split('#')[0]
self.cook = cki
self.total_amount = 0
self.id = None
self.hd = {
'User-Agent': "okhttp/3.14.9",
'Accept': 'application/json, text/plain, */*',
'Version': "1.57.2",
'Content-Type': "application/x-www-form-urlencoded;charset=UTF-8",
'Authorization': self.token,
'channel': "android_app"
}
self.hd1 = {
'User-Agent': "okhttp/3.14.9",
'Connection': "Keep-Alive",
'Accept-Encoding': "gzip",
'Authorization': self.token,
'Version': "1.57.2",
'channel': "android_app",
'phoneBrand': "Redmi",
'Content-Type': "application/x-www-form-urlencoded;charset=UTF-8"
}
self.listUrl = 'https://userapi.qiekj.com/task/list'
self.phone_url = 'https://userapi.qiekj.com/user/info'
self.check_url = 'https://userapi.qiekj.com/user/balance'
self.rcrw_url = 'https://userapi.qiekj.com/task/completed'
self.sign_url = 'https://userapi.qiekj.com/signin/doUserSignIn'
self.jrjf_url = "https://userapi.qiekj.com/integralRecord/pageList"
self.dkbm_url = 'https://userapi.qiekj.com/markActivity/doApplyTask'
self.dkbm_url1 = 'https://userapi.qiekj.com/markActivity/doMarkTask'
self.shop_url = 'https://userapi.qiekj.com/integralUmp/rewardIntegral'
self.jtjl_url = 'https://userapi.qiekj.com/ladderTask/applyLadderReward'
self.dkbm_url2 = "https://userapi.qiekj.com/markActivity/markTaskReward"
self.bmcodeurl = 'https://userapi.qiekj.com/markActivity/queryMarkTaskByStartTime'
# 签名
def sg(self, y):
timestamp = str(int(time.time() * 1000))
parsed_url = urlparse(y)
path = parsed_url.path
data = f"appSecret=nFU9pbG8YQoAe1kFh+E7eyrdlSLglwEJeA0wwHB1j5o=&channel=android_app×tamp={timestamp}&token={self.token}&version=1.57.2&{path}"
data1 = f"appSecret=Ew+ZSuppXZoA9YzBHgHmRvzt0Bw1CpwlQQtSl49QNhY=&channel=alipay×tamp={timestamp}&token={self.token}&{path}"
sign = hashlib.sha256(data.encode()).hexdigest()
sign1 = hashlib.sha256(data1.encode()).hexdigest()
return sign, sign1, timestamp
# 检测token有效性
def name(self):
try:
data = {'token': self.token}
if dl:
re = requests.post(self.phone_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
re = requests.post(self.phone_url, data=data, headers=self.hd).json()
code = re['code']
if code == 0:
try:
if "#" in self.cook:
self.phone = self.cook.split('#')[1]
else:
self.phone = p(re['data']['phone'])
except:
print(f'[账号{i + 1}] Cookie异常')
exit(0)
self.id = re["data"]["id"]
sign, sign1, timestamp = self.sg(self.check_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
r = requests.post(self.check_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r = requests.post(self.check_url, data=data, headers=self.hd).json()
coin_code = r['code']
balance = r['data']['integral'] if coin_code == 0 else 'N/A'
print(f"[{self.phone}] ✅登录成功!积分余额: {balance}")
return self.phone
else:
msg = re["msg"]
print(f"[账号{i + 1}] ❎登录失败==> {msg}")
return False
except Exception as e:
print("❎请求出现错误")
return False
# 签到
def sign(self, max_retries=3):
retries = 0
while retries < max_retries:
try:
data = {'activityId': '600001', 'token': self.token}
sign, sign1, timestamp = self.sg(self.sign_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
re = requests.post(self.sign_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
re = requests.post(self.sign_url, data=data, headers=self.hd).json()
msg = re['msg']
print(f"[{self.phone}] ✅签到==> {msg}")
break
except Exception as e:
retries += 1
print(f"❎签到错误,重试次数: {retries}/{max_retries}")
if retries >= max_retries:
print("❎达到最大重试次数,跳过该任务")
break
time.sleep(1)
# 浏览商品
def shop(self):
for t in range(6):
try:
b1 = string.ascii_lowercase + string.digits
item_code = ''.join(random.choice(b1) for _ in range(6))
data = {'itemCode': item_code, 'token': self.token}
sign, sign1, timestamp = self.sg(self.shop_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
re = requests.post(self.shop_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
re = requests.post(self.shop_url, data=data, headers=self.hd).json()
q = re["data"]
if q is not None:
amount = re["data"]["rewardIntegral"]
print(f"[{self.phone}] ✅第{t + 1}次浏览商品成功,获得==> {amount}!")
else:
print(f"[{self.phone}] ❎第{t + 1}次浏览商品失败==> {q}")
break
except Exception as error:
print("❎浏览商品出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 支付宝广告任务
def zfbgg(self):
for t in range(11):
try:
data = {'taskType': "9", 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
hd1 = {
'User-Agent': "Dalvik/2.1.0 (Linux; U; Android 13; MEIZU 20 Build/TKQ1.221114.001) Chrome/105.0.5195.148 MYWeb/0.11.0.240407200246 UWS/3.22.2.9999 UCBS/3.22.2.9999_220000000000 Mobile Safari/537.36 NebulaSDK/1.8.100112 Nebula AlipayDefined(nt:WIFI,ws:1080|1862|2.8125) AliApp(AP/10.5.88.8000) AlipayClient/10.5.88.8000 Language/zh-Hans useStatusBar/true isConcaveScreen/true NebulaX/1.0.0 DTN/2.0",
'Connection': "Keep-Alive",
'Accept-Encoding': "gzip",
'Content-Type': "application/x-www-form-urlencoded",
'Accept-Charset': "UTF-8",
'channel': "alipay",
'sign': sign1,
'x-release-type': "ONLINE",
'version': "",
'timestamp': timestamp
}
if dl:
response = requests.post(self.rcrw_url, data=data, headers=hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
response = requests.post(self.rcrw_url, data=data, headers=hd1).json()
msg = response["data"]
if msg:
print(f"[{self.phone}] ✅第{t + 1}次支付宝广告==> {msg}")
else:
print(f"[{self.phone}] ❎第{t + 1}次支付宝广告失败==> {msg}")
break
except Exception as error:
print("❎支付宝广告出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 看视频赚积分
def kspzjf(self):
for t in range(6):
try:
data = {'taskType': "2", 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
response = requests.post(self.rcrw_url, data=data, headers=self.hd, proxies=global_proxy,
timeout=10, verify=False).json()
else:
response = requests.post(self.rcrw_url, data=data, headers=self.hd).json()
msg = response["data"]
if msg:
print(f"[{self.phone}] ✅第{t + 1}次看视频赚积分==> {msg}")
else:
print(f"[{self.phone}] ❎第{t + 1}次看视频赚积分失败==> {msg}")
break
except Exception as error:
print("❎看视频赚积分出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 看广告赚积分
def kggzjf(self):
for t in range(9):
try:
data = {'taskCode': '18893134-715b-4307-af1c-b5737c70f58d', 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
res = requests.post(self.rcrw_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
res = requests.post(self.rcrw_url, data=data, headers=self.hd).json()
msg = res['data']
if msg:
print(f'[{self.phone}] ✅第{t + 1}次看广告赚积分==> {msg}')
else:
print(f'[{self.phone}] ❎第{t + 1}次看广告赚积分失败==> {msg}')
break
except Exception as e:
print("❎看广告赚积分出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 不知名任务
def ycrw(self):
for t in range(9):
try:
data = {'taskCode': '15eb1357-b2d9-442f-a19f-dbd9cdc996cb', 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
re = requests.post(self.rcrw_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
re = requests.post(self.rcrw_url, data=data, headers=self.hd).json()
msg = re['data']
if msg:
print(f'[{self.phone}] ✅第{t + 1}次看广告赚积分==> {msg}')
else:
print(f'[{self.phone}] ❎第{t + 1}次看广告赚积分失败==> {msg}')
break
except Exception as e:
print("❎不知名任务出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 大鹅积分
def dejf(self):
for t in range(10):
try:
data = {'taskCode': '5', 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
re = requests.post(self.rcrw_url, data=data, headers=self.hd, proxies=global_proxy, timeout=10,
verify=False).json()
else:
re = requests.post(self.rcrw_url, data=data, headers=self.hd).json()
msg = re['data']
if msg:
print(f'[{self.phone}] ✅第{t + 1}次大鹅积分当钱花==> {msg}')
else:
print(f'[{self.phone}] ❎第{t + 1}次大鹅积分当钱花==> {msg}')
break
except Exception as e:
print("❎大鹅积分当钱花出现错误")
continue
if dl:
time.sleep(2)
else:
time.sleep(6)
# 遍历日常
def rcrw(self):
try:
data = {'token': self.token}
sign, sign1, timestamp = self.sg(self.listUrl)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
response = requests.post(self.listUrl, data=data, headers=self.hd).json()
code = response.get('code', -1)
if code == 0:
tasks = response.get('data', {}).get('items', [])
if tasks:
print(f'[{self.phone}] ✅获取到{len(tasks)}个日常任务')
for item in tasks:
title = item["title"]
id1 = item["taskCode"]
data = {'taskCode': id1, 'token': self.token}
sign, sign1, timestamp = self.sg(self.rcrw_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
if dl:
time.sleep(2)
else:
time.sleep(6)
if dl:
response1 = requests.post(self.rcrw_url, data=data, headers=self.hd, proxies=global_proxy,
timeout=10, verify=False).json()
else:
response1 = requests.post(self.rcrw_url, data=data, headers=self.hd).json()
data1 = response1.get("data", {})
if data1:
print(f'[{self.phone}] ✅完成日常任务[{title}]成功==> {data1}')
else:
print(f'[{self.phone}] ❎完成日常任务[{title}]失败==> {data1}')
if dl:
time.sleep(2)
else:
time.sleep(6)
else:
print("❎获取任务列表为空!")
else:
print("❎获取任务列表失败!")
except requests.RequestException as e:
print(f"❎网络请求错误: {e}")
except Exception as e:
print(f"❎遍历日常出现错误: {e}")
# 领取阶梯奖励
def jtjl(self):
try:
url = "https://userapi.qiekj.com/ladderTask/ladderTaskForDay"
params = {
'token': self.token
}
sign, sign1, timestamp = self.sg(url)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
if dl:
r = requests.get(url, params=params, headers=self.hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r = requests.get(url, params=params, headers=self.hd1).json()
if r['code'] == 0:
reward_list = [item['rewardCode'] for item in r['data']['ladderRewardList']]
for rewar in reward_list:
try:
url1 = "https://userapi.qiekj.com/ladderTask/applyLadderReward"
data = {'rewardCode': rewar, 'token': self.token}
sign, sign1, timestamp = self.sg(url1)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
if dl:
r1 = requests.post(url1, data=data, headers=self.hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r1 = requests.post(url1, data=data, headers=self.hd1).json()
if r1["code"] == 0:
reward = r1["data"]["reward"]
print(f'[{self.phone}] ✅领取任务id[{rewar}]成功==> {reward}')
else:
print(f'[{self.phone}] ❎领取任务id[{rewar}]失败==> {r1["msg"]}')
if dl:
time.sleep(2)
else:
time.sleep(6)
except Exception as e:
print("❎领取阶梯奖励出现错误")
continue
else:
print("获取任务列表失败!")
except Exception as e:
print("获取阶梯奖励列表出现错误")
# 时间段奖励
def timejl(self, max_retries=3):
retries = 0
while retries < max_retries:
try:
url = "https://userapi.qiekj.com/timedBenefit/applyRewardForTimeBenefit"
params = {
'token': self.token
}
sign, sign1, timestamp = self.sg(url)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
if dl:
r = requests.get(url, params=params, headers=self.hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r = requests.get(url, params=params, headers=self.hd1).json()
if r["code"] == 0:
print(f'[{self.phone}] ✅领取时间段奖励成功==> {r["data"]["rewardNum"]}')
break
else:
print(f'[{self.phone}] ❎领取时间段奖励失败==> {r["msg"]}')
break
except Exception as e:
retries += 1
print(f"❎完成时间段任务出现错误: {e}. 重试次数: {retries}/{max_retries}")
if retries >= max_retries:
print("❎达到最大重试次数,跳过该任务")
break
time.sleep(1)
# 打卡报名
def dkbm(self):
try:
ti = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
data = {'startTime': ti, 'token': self.token}
sign, sign1, timestamp = self.sg(self.bmcodeurl)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
if dl:
r = requests.post(self.bmcodeurl, data=data, headers=self.hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r = requests.post(self.bmcodeurl, data=data, headers=self.hd1).json()
code = r['code']
if code == 0:
try:
code1 = r['data']['taskCode']
data = {'taskCode': code1, 'token': self.token}
sign, sign1, timestamp = self.sg(self.dkbm_url)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
time.sleep(2)
if dl:
r1 = requests.post(self.dkbm_url, data=data, headers=self.hd1, proxies=global_proxy, timeout=10,
verify=False).json()
else:
r1 = requests.post(self.dkbm_url, data=data, headers=self.hd1).json()
code2 = r1['code']
data1 = r1["data"]
msg = r1["msg"]
if code2 == 0:
print(f"[{self.phone}] ✅打卡报名成功==> {data1}")
else:
print(f"[{self.phone}] ❎打卡报名失败==> {msg}")
except Exception as e:
print("❎打卡报名出现错误")
else:
print(f"获取code失败!{r}")
except Exception as e:
print("获取打卡报名id出现错误")
# 领取瓜分资格
def gfjf(self):
try:
current_datetime = datetime.now()
yesterday_datetime = current_datetime - timedelta(days=1)
yesterday_now = yesterday_datetime.replace(hour=current_datetime.hour, minute=current_datetime.minute,
second=current_datetime.second,
microsecond=current_datetime.microsecond)
k = yesterday_now.strftime("%Y-%m-%d %H:%M:%S")
data = {"startTime": k, "token": self.token}
sign, sign1, timestamp = self.sg(self.bmcodeurl)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
if dl:
r = requests.post(self.bmcodeurl, headers=self.hd1, data=data).json()
else:
r = requests.post(self.bmcodeurl, headers=self.hd1, data=data).json()
if r['code'] == 0:
code1 = r['data']['taskCode']
data1 = {'taskCode': code1, 'token': self.token}
sign, sign1, timestamp = self.sg(self.dkbm_url1)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
time.sleep(2)
if dl:
r1 = requests.post(self.dkbm_url1, headers=self.hd1, data=data1).json()
else:
r1 = requests.post(self.dkbm_url1, headers=self.hd1, data=data1).json()
print(f"[{self.phone}] 领取瓜分资格==> {r1['msg']}")
return code1
else:
print(f"❎获取taskCode失败! {r}")
return None
except Exception as e:
print(f"领取瓜分资格出现错误")
# 瓜分积分
def gfjf1(self, max_retries=3):
retries = 0
while retries < max_retries:
try:
data1 = {'taskCode': self.gfjf(), 'token': self.token}
sign, sign1, timestamp = self.sg(self.dkbm_url2)
self.hd1['sign'] = sign
self.hd1['timestamp'] = timestamp
req = requests.post(self.dkbm_url2, headers=self.hd1, data=data1).json()
a1 = req['data']
print(f"[{self.phone}] ✅报名瓜分成功==> {a1}")
break
except Exception as e:
retries += 1
print(f"❎报名瓜分错误,重试次数: {retries}/{max_retries}")
if retries >= max_retries:
print("❎达到最大重试次数,跳过该任务")
break
time.sleep(1)
def xieru(self, rw, dk):
try:
new_data = {
"pgid": str(self.id)
}
if not os.path.exists("./pgsh.json"):
with open("./pgsh.json", "w") as file:
json.dump({}, file)
with open("./pgsh.json", "r") as file:
try:
data = json.load(file)
except json.decoder.JSONDecodeError:
data = {}
if rw == 1 and new_data["pgid"] in data and data[new_data["pgid"]]["rw"] == 1:
print("任务记录已存在。")
return False
elif dk == 1 and new_data["pgid"] in data and data[new_data["pgid"]]["dk"] == 1:
print("打卡记录已存在。")
return False
else:
if rw == 1:
data[new_data["pgid"]] = {"rw": 1, "dk": 0}
elif dk == 1:
data[new_data["pgid"]] = {"rw": 1, "dk": 1}
with open("./pgsh.json", "w") as file:
json.dump(data, file)
print("✅写入记录文件成功。")
return True
except Exception as e:
print(f"❎写入记录文件出现错误,初始化文件内容")
with open("./pgsh.json", "w") as file:
json.dump({}, file)
# 读取指定值是否存在
def duqu(self, aa, rw, dk):
try:
if not os.path.exists("./pgsh.json"):
with open("./pgsh.json", "w") as file:
json.dump({}, file)
with open("./pgsh.json", "r") as file:
try:
data = json.load(file)
except json.decoder.JSONDecodeError:
data = {}
if rw == 1:
if str(aa) in data:
return data[str(aa)]["rw"]
else:
return False
elif dk == 1:
if str(aa) in data:
return data[str(aa)]["dk"]
else:
return False
except Exception as e:
print(f"读取记录文件出现错误,初始化文件内容")
with open("./pgsh.json", "w") as file:
json.dump({}, file)
# 今日积分
def jrjf(self, i, token1):
token = token1.split('#')[0]
try:
hd1 = {
'User-Agent': "okhttp/3.14.9",
'Accept': 'application/json, text/plain, */*',
'Version': "1.57.2",
'Content-Type': "application/x-www-form-urlencoded;charset=UTF-8",
'Authorization': token,
'channel': "android_app"
}
data = {'token': token}
sign, sign1, timestamp = self.sg(self.phone_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
r = requests.post(self.phone_url, data=data, headers=hd1).json()
if r['code'] == 0:
try:
sign, sign1, timestamp = self.sg(self.check_url)
self.hd['sign'] = sign
self.hd['timestamp'] = timestamp
r1 = requests.post(self.check_url, data=data, headers=hd1).json()
coin_code = r1['code']
balance = r1['data']['integral'] if coin_code == 0 else 'N/A'
except Exception as e:
print(f"获取积分失败: {e}")
balance = 'N/A'
try:
phone = p(r['data']['phone'])
data = {
'page': (None, '1'),
'pageSize': (None, '100'),
'type': (None, '100'),
'receivedStatus': (None, '1'),
'token': (None, token),
}
hd = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 14; 23117RK66C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/118.0.0.0 Mobile Safari/537.36 AgentWeb/5.0.0 UCBrowser/11.6.4.950 com.qiekj.QEUser',
'Accept': 'application/json, text/plain, */*',
'channel': 'android_app',
}
re_response = requests.post(self.jrjf_url, headers=hd, files=data).json()
current_date = datetime.now().strftime('%Y-%m-%d')
total_amount = 0
for item in re_response['data']['items']:
received_date = item['receivedTime'][:10]
if received_date == current_date:
total_amount += item['amount']
print(f"[{phone}] ✅今日获得积分: {total_amount}")
return {
'序号': i + 1,
'用户': phone,
'arg1': balance,
'arg2': total_amount
}
except Exception as e:
print(f"[账号{i + 1}] ❎查询当日积分出现错误: {e}")
return {
'序号': i + 1,
'用户': i + 1,
'arg1': f"❎",
'arg2': f"❎"
}
else:
print(f"[账号{i + 1}] ❎登录失败: {r['msg']}")
return {
'序号': i + 1,
'用户': i + 1,
'arg1': f"{r['msg']}",
'arg2': f"{r['msg']}"
}
except requests.exceptions.RequestException as e:
print(f"[账号{i + 1}] ❎网络请求错误: {e}")
return {
'序号': i + 1,
'用户': i + 1,
'arg1': f"❎",
'arg2': f"❎"
}
except Exception as e:
print(f"[账号{i + 1}] ❎查询当日积分出现错误: {e}")
return {
'序号': i + 1,
'用户': i + 1,
'arg1': f"❎",
'arg2': f"❎"
}
def jf(self):
try:
msg_list = []
print(f"======开始查询所有账号当日收益======")
for n, yy in enumerate(cookies):
msg = self.jrjf(n, yy)
msg_list.append(msg)
sorted_data = sorted(msg_list, key=lambda x: x['序号'])
table_content = ''
for row in sorted_data:
table_content += f"<tr><td style='border: 1px solid #ccc; padding: 6px;'>{row['序号']}</td><td style='border: 1px solid #ccc; padding: 6px;'>{row['用户']}</td><td style='border: 1px solid #ccc; padding: 6px;'>{row['arg1']}</td><td style='border: 1px solid #ccc; padding: 6px;'>{row['arg2']}</td></tr>"
self.msg = f"<table style='border-collapse: collapse;'><tr style='background-color: #f2f2f2;'><th style='border: 1px solid #ccc; padding: 8px;'>🆔</th><th style='border: 1px solid #ccc; padding: 8px;'>用户名</th><th style='border: 1px solid #ccc; padding: 8px;'>总积分</th><th style='border: 1px solid #ccc; padding: 8px;'>今日积分</th></tr>{table_content}</table>"
if ts:
self.send_msg()
except Exception as e:
print(f"查询所有账号当日收益出现错误: {e}")
if int(b) <= now_time or now_time <= 1:
with open("./pgsh.json", "w") as file:
json.dump({}, file)
print("已重置文件内容")
def send_msg(self):
if 'WxPusher_token' in os.environ and os.environ['WxPusher_token'] is not None:
self.WxPusher_ts()
if 'PUSH_PLUS_TOKEN' in os.environ and os.environ['PUSH_PLUS_TOKEN'] is not None:
self.pushplus_ts()
else:
print("❎推送失败,未配置推送")
def WxPusher_ts(self):
try:
url = 'https://wxpusher.zjiecode.com/api/send/message'
params = {
'appToken': WxPusher_token,
'content': self.msg,
'summary': '胖乖生活',
'contentType': 3,
'uids': [WxPusher_uid]
}
re = requests.post(url, json=params)
msg = re.json().get('msg', None)
print(f'WxPusher推送结果:{msg}\\\n')
except Exception as e:
print(f"WxPusher推送出现错误: {e}")
def pushplus_ts(self):
try:
url = 'https://www.pushplus.plus/send/'
data = {
"token": pushplus_token,
"title": '胖乖生活',
"content": self.msg
}
re = requests.post(url, json=data)
msg = re.json().get('msg', None)
print(f'pushplus推送结果:{msg}\\\n')
except Exception as e:
print(f"pushplus推送出现错误: {e}")
def start(self):
if self.name():
print("-----执行领取时间段奖励-----")
self.timejl()
if int(a) <= now_time < int(b):
print("--------滴滴车发车,坐稳了--------\\\n")
if self.duqu(self.id, 1, 0) == 0:
print("-----开始执行签到-----")
self.sign()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----先遍历个日常,防止漏网之鱼-----")
self.rcrw()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行支付宝看广告-----")
self.zfbgg()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行赚大鹅积分-----")
self.dejf()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行看视频赚积分-----")
self.kspzjf()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行看广告赚积分-----")
self.kggzjf()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行浏览商品赚积分-----")
self.shop()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行隐藏任务-----")
self.ycrw()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行打卡报名-----")
self.dkbm()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----开始执行领取瓜分资格-----")
self.gfjf()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----执行领取阶梯奖励----")
self.jtjl()
if dl:
time.sleep(2)
else:
time.sleep(6)
print("-----任务执行完毕,记录id-----")
self.xieru(1, 0)
else:
print("当前账号已执行过任务,跳过执行")
else:
print(f"当前时间非{int(a)}-{int(b)},跳过今日任务")
if 14 <= now_time <= 16:
print("-----开始执行瓜分打卡积分-----")
if self.duqu(self.id, 0, 1) == 0:
self.gfjf1()
self.xieru(0, 1)
else:
print("当前账号已执行过任务,跳过执行")
else:
print(f"当前时间非14-16,跳过瓜分打卡积分")
if __name__ == '__main__':
print(f"当前版本: {v}")
print("TL库:https://github.com/3288588344/toulu.git")
print("QQ频道:98do10s246")
print("微信机器人:kckl6688")
print("tg频道:https://t.me/TLtoulu")
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
print = partial(print, flush=True)
if jh:
print("当前聚合ck模式,所有模式ck生效")