-
Notifications
You must be signed in to change notification settings - Fork 22
/
checkin.py
218 lines (201 loc) · 17.6 KB
/
checkin.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
import time
import datetime
import random
import requests
import base64
import json
import hashlib
from Crypto.Cipher import AES
# print(base64.b64decode('F5D21C18A426B82597F004F1292805B08BCABA6AA27EDEE6FBAE3AF8DE7F67240B3D2CCB7B3B30EA47AAF7F71FBF7E3904EE7EBF2CA35AC1FC7669ED6339578526EE5BE092D84B9D4A2F489AA2CECDA090422F94E9D167F6636761D72C00BD3372CA6ED66BA77B880170922CC3E2FA847D86AA51410DF4CBB7A9522B0AC9398FA9D3E5AF3C98B9D9C62CE3846993EFAD'))
def encrypt(key, text):
cryptor = AES.new(key.encode('utf8'), AES.MODE_CBC, b'0102030405060708')
length = 16
count = len(text.encode('utf-8'))
if (count % length != 0):
add = length - (count % length)
else:
add = 16
pad = chr(add)
text1 = text + (pad * add)
ciphertext = cryptor.encrypt(text1.encode('utf8'))
cryptedStr = str(base64.b64encode(ciphertext), encoding='utf-8')
return cryptedStr
def md5(str):
hl = hashlib.md5()
hl.update(str.encode(encoding='utf-8'))
return hl.hexdigest()
def protect(text):
return {"params": encrypt('TA3YiYCfY2dDJQgg', encrypt('0CoJUm6Qyw8W8jud', text)), "encSecKey": "84ca47bca10bad09a6b04c5c927ef077d9b9f1e37098aa3eac6ea70eb59df0aa28b691b7e75e4f1f9831754919ea784c8f74fbfadf2898b0be17849fd656060162857830e241aba44991601f137624094c114ea8d17bce815b0cd4e5b8e2fbaba978c6d1d14dc3d1faf852bdd28818031ccdaaa13a6018e1024e2aae98844210"}
s = requests.Session()
header = {}
url = "https://music.163.com/weapi/login/cellphone"
url2 = "https://music.163.com/weapi/point/dailyTask"
url3 = "https://music.163.com/weapi/v1/discovery/recommend/resource"
url4 = "https://music.163.com/weapi/share/friends/resource"
url5 = "https://music.163.com/weapi/point/dailyTask"
url6 = "https://music.163.com/weapi/usertool/task/point/receive"
url7 = "https://music.163.com/weapi/playlist/detail"
logindata = {
"phone": input(),
"countrycode": "86",
"password": md5(input()),
"rememberLogin": "true",
}
key = input() #server酱推送
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36',
"Referer": "http://music.163.com/",
"Accept-Encoding": "gzip, deflate",
"Cookie": input()
}
headers2 = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36',
"Referer": "http://music.163.com/",
"Accept-Encoding": "gzip, deflate",
"Cookie": "os=pc; osver=Microsoft-Windows-10-Professional-build-10586-64bit; appver=7.2.24; channel=netease; __remember_me=true;"
}
res = s.post(url=url, data=protect(json.dumps(logindata)), headers=headers)
tempcookie = res.cookies
object = json.loads(res.text)
if object['code'] == 200:
print("登录成功!")
else:
print("登录失败!请检查密码是否正确!"+str(object['code']))
exit(object['code'])
res = s.post(url=url2, data=protect('{"type":0}'), headers=headers)
object = json.loads(res.text)
if object['code'] != 200 and object['code'] != -2:
print("移动端签到时发生错误:"+object['msg'])
else:
if object['code'] == 200:
print("移动端签到成功,经验+"+str(object['point']))
osSign = "云村移动端签到成功,经验+"+str(object['point'])
# requests.get('https://sc.ftqq.com/SCU74663T20ed2886a458ab9e3be21f3de4e8fd965e0b13de3ff1b.send?text=云村移动端签到成功,经验+'+str(object['point']))
else:
print("移动端重复签到")
osSign="移动端重复签到"
res=s.post(url=url2, data=protect('{"type":1}'), headers=headers)
object=json.loads(res.text)
if object['code'] != 200 and object['code'] != -2:
print("PC端签到时发生错误:"+object['msg'])
else:
if object['code'] == 200:
print("PC端签到成功,经验+"+str(object['point']))
pcSign="PC端签到成功,经验+"+str(object['point'])
# requests.get('https://sc.ftqq.com/SCU74663T20ed2886a458ab9e3be21f3de4e8fd965e0b13de3ff1b.send?text=云村PC端签到成功,经验+'+str(object['point']))
else:
print("PC端重复签到")
pcSign="PC端重复签到"
# 分享歌曲
songList =[4872567,1336856498,359735,1463505060,472141618,1362521421,25780279,1374489910,1300287,17982528,4226232,186843,553543179,135028,1314931825,394524,26883589,33699518,31877511,3413782,1761766,29450577,31311126,357238,453268744,327451,863553295,456136072,387457,394543,1341054243,29450573,536623692,16426485,406072193,356480,91429,91444,17276013,270615,863554092,109579,209245,5235179,482979317,31311140,485413811,209436,570097955,418603177,91448,461080452,186046,1302066297,216764,306991,4873341,189552,85562,1776816,863553296,5134005,188591,472137696,109528,863489981,28784206,157808,422427460,19145688,2176169,25730796,82268,299518,17261721,4281062,31529024,461584268,186699,656405,5280037,5272970,317885,28186082,273915,110669,497400537,38582036,26620455,28642832,447925066,136951,28138269,4334701,5247458,27937432,437715323,28111201,118976,277686,30394928,40249668,233292,102651,102600,449643461,390536,34364196,28176037,28009992,390557,60398,4237530,210991,438462712,112167,63750,5251587,25641848,507815173,2001320,164009,29392759,534067044,109073,29019489,93948,1078365,4279075,28315774,5046367,22746144,208958,390558,444003233,562594267,29750958,28287189,2308680,17177367,188878,306975,251464,1297750769,35920348,214921,1295824647,194092,67339,98021,5280076,156292,28038055,27902937,328895,5248928,82056,31721541,262938,259365,260703,195595,5232526,332743,82457,215368,326710,26145723,22701801,417596048,5282403,64638,418602584,417250673,224000,213617,526116080,239682,445886392,18127640,28695638,28885472,28310930,1039333,27937466,394841,812400,491943068,536622304,28409805,541687281,452620634,67288,67570,188747,528335245,1777667,531051217,419373997,158403,287752,234252,235096,190241,299454,454069805,460410002,463159617,416700932,86477,68075,139558,28138170,363409,117220,344156,240055,1217823,422463688,346079,29544259,1215494,2007506,27514865,210089,22715757,346085,174119,298900,92939,190380,94961,29431270,330008,514055051,109938,26608529,186492,300538,299460,299650,376647,451768026,29999506,211442,188555,189714,29732659,407459600,394488,17858810,493275349,3932076,487206688,26584442,636165,1475363,410801521,194405,1348599,258684,151646,156772,151618,329925,156736,31967217,468252710,27180681,29593805,350760,30394959,95651,413829873,409650012,28793502,186469,37955044,33728453,387588,5043818,29759733,490595478,64293,189718,426343036,379785,427142762,25643130,65107,364958,185643,29017261,439139384,30394202,407759199,28643022,4900975,32272267,640565,474932841,475207448,317108,5280161,105431,409031377,442314991,422428548,444269202,21809247,5280051,26026783,109496,445238199,3405868,28188171,3413895,16779718,27198279,306967,455311479,34690628,292587,5041846,427610763,428642306,413829859,413831994,26620638,417595364,26092806,417596830,31421442,185878,186018,415792918,185815,185904,448916053,440411424,408307090,28497537,29717271,437859519,442869498,188703,19673369,29592146,426881505,426881503,426881487,287035,3879733,274863,27867449,406072144,411314656,16629199,27510434,406072138,27646786,28009051,25731320,26060065,406238,27733284,27747330,34078196,423703429,29535690,17793698,595682,187408,28378127,186820,287039,27646205,668248,38592976,33233915,31273654,299604,431357712,414706021,29379816,41666363,740649,4898499,28786397,28461734,740558,480353,92429,26608941,33911781,541230,740611,730669,624879,30431376,22748769,659094,741961,28940202,28288503,28188434,428095913,27678663,30352891,28940201,31445554,4433364,16607998,624899,27867140,22781037,28940203,22676620,26099351,28830803,740508,694286,818186,593007,857619,22697895,22748787,411921855,22773649,297587,605740,27874938,625273,296837,386837,28668277,409941447,39443443,25657280,356034,238831,28285910,26127556,31814411,408814900,412319476,30500470,229616,229594,28310921,33544485,28923659,25643258,30070681,25643236,25642946,29850094,155785,186842,208904,209326,30431370,33162225,33162226,199768,287061,2004435,4874623,30431366,171269,171530,27906147,400875271,400876303,28283665,35847388,287634,26211155,152392,152444,369128,4273642,422132917,5093684,260175,26075553,21564643,21253953,431795577,29450578,21597340,27904144,451620178,202373,466768491,29217536,27901423,27908100,34998481,504624714,557581476,573384240,96945,5269046,640866,146225,234263,277766,187837,25643229,26447698,620487,27808295,2866921,176062,310909,290823,421885447,4876565,343065,30841620,28717724,31750709,95638,17990609,448393515,29850531,740291,741919,32217106,442016663,185643,382029,417859076,145223,427016671,411314657,411314659,411315635,365598,32196201,355961,423703430,423703423,186457,409031377,444269202,21809247,5280051,26026783,445238199,19572271,28188171,3405868,16779718,27198279,306967,34690628,5041846,428642306,413831994,417595364,417596830,186014,185878,440411424,29592146,27510434,411314656,406072138,28009051,25731320,27733284,27747330,29535690,186820,287039,28940201,27867140,26099351,694286,22748787,22773649,27874938,386837,356034,31814411,30500470,28310921,25643354,167880,30431370,33162226,287061,401722038,171269,2117005,29774430,152390,152389,152394,152426,152444,768801,369128,480426313,37955044,36668810,28814036,475279499,31789010,25657282,1347133940,448749148,415904452,34072434,424995313,460043704,422132237,513357140,1334246005,464035016,1318733599,446557042,436675656,504492138,1347227968,1366537490,516750031,1380022214,33085220,483024211,566435601,862657136,511921537,552650454,1384309833,417833443,509135896,514206286,1304861566,410519101,28566356,22843786,28208212,1332582424,28718301,483242395,2639477,28481189,27829053,549484811,468882987,470573623,564742278,539982411,33522489,553899593,545947179,472948115,451680013,572763271,1364343491,500684078,476630942,1366775011,489110016,31245090,473940907,26548584,1359113596,1324159296,436514415,1356580767,427595940,1311535958,27871272,444324644,522617477,564094072,530967641,1299871688,33035577,523042017,30569536,442869240,32102058,468517531,461544312,423118986,1344440225,1362822707,1314780499,507795651,468490459,487587444,864648486,546838014,32432811,470795480,532776335,28921696,4433364,28854398,28639182,864648551,553479159,1403074111,1323832567,463352636,33337002,573673964,457552086,451991303,1320697603,3026554,28593339,483024225,523421716,1326439375,556053856,29418363,456185577,572166420,31234202,405485737,1296896326,3986241,19292984,1299563871,573582024,4164331,20671335,28254519,31053184,22843782,28157586,29482234,27914279,1331322046,28188171,864513777,506196018,493042797,28832241,32019331,556216490,506288341,431096716,487454620,1318522028,25657233,475597835,402061023,460043710,436016463,574928272,490602245,526161446,439122515,34144434,31108473,25657280,511678913,36019282,509612912,19094999,466794339,553813030,412175989,423118988,29709781,428375694,474305506,34913089,32574252,5093684,505665222,417859039,471411255,31356499,485612576,29787426,29592100,473865426,421148673,515601126,448317566,39224884,21792987,31081299,32022492,16375205,543987451,483156032,557704117,543927569,475072054,543006339,479408216,531842654,1310319885,414979759,28796621,534072344,544231701,415792222,39324743,28402345,32807699,1314777725,505828528,529557738,464647338,29910080,545655045,440310367,471565537,554217208,460323657,29771146,404276447,469272852,491082791,533017528,503123018,1294889892,491271737,437909145,25657274,465920383,521416693,529824982,556066474,571336983,534228257,427542186,487375361,567316473,424155395,28959074,29535349,1318511471,1346474112,1301572238,1313070706,412951708,418602088,520928254,552145020,4331105,28864241,546722490,2526625,421423245,569870379,1309262455,34749984,32897242,480648464,865606053,37722278,424495485,454069978,5134011,493275043,36990266,463159617,406072193,464674427,2188235,862768857,471969020,30212890,22843785,460043703,2639750,41667979,2080139,2119755,27560017,2175282,4154790,22481464,30841076,425065695,475174840,41462775,18611643,3407082,2001276,418603096,423997615,30070142,457567102,1076292,26092806,36496695,37169348,414670127,27984052,472361236,456185056,28844472,19032216,21795464,18374823,4109336,32341765,461518895,29480187,3160951,28248872,5046367,19567918,424155394,32341392,468490461,19711382,2080326,28756834,34228719,3154082,17753288,3555220,18298949,27646851,28828120,26131191,524164335,30431647,415792064,32069280,33497559,515573352,3026583,449824945,420397141,456175020,468490458,426291544,518895684,515573993,441429244,500637550,29806043,28111294,29713617,29422008,473602620,440208476,32639368,33291435,423227295,402070862,444269135,18708516,493283657,32102397,415793249,17112299,509728841,3026556,18638057,411314681,481764066,442495638,29722263,38592976,460043372,423228325,461518855,451703096,442315372,457537752,25862803,411315504,440101136,37653063,465675773,515269424,472361096,31234244,525240439,441491080,461932356,436668683,525940336,2701514,503855598,439121048,213737,229090,427142481,29009655,428591384,507532195,520274067,20953761,483024028,444548120,469104843,401249910,403012527,19207074,26060065,520525412,491294233,33418570,17996972,18680851,480517594,32835004,430053872,35864736,18836961,458238099,31370203,492145159,494865824,2587251,3550532,27706564,3852042,466122659,28347352,21253966,466122460,466794276,489041829,460298206,26407811,511236571,447296411,28727903,4380582,27846862,416700932,1695569,227724,432698441,439076364,18449193,410801521,465920775,402070863,31654042,471761048,492146902,503058959,473817398,16426574,409916250,464035863,491950183,499465427,512621703,515453363,2925107,29922545,27566922,403710307,26349699,19032267,1807824,29019227,29966565,30496792,456084222,497463179,493285618,30798612,17706537,457552211,28661564,437605840,461544126,28493605,28315789,516823096,1807865,27845535,4108623,29561089,28768434,428203132,1936565,438803640,522444650,28859948,26217020,445666806,5048990,21224493,3157058,27598731,32341393,21224495,500410102,28282082,475597495,30953009,512376599,19572271,500412390,2001320,457800857,2866921,29750825,438900437,27949374,28694864,28240407,3402885,473404348,444356814,30394891,26213616,425100405,409647737,19830038,498331794,420922950,441491167,466126510,461347998]
# res=s.post(url=url7, data=protect('{"id":2016107008}'), headers=headers)
# allsongs = res.json()['result']['tracks']
# for song in allsongs:
# songList.append(song['id'])
# print(songList)
def sendSong():
global sendStr
res=s.post(url=url4, data=protect('{"type":"song","id":'+str(songList[random.randint(0,len(songList))])+',msg:"分享歌曲","csrf_token":"' + \
requests.utils.dict_from_cookiejar(tempcookie)['__csrf']+'"}'), headers=headers)
object=json.loads(res.text)
if object['code'] != 200 and object['code'] != -2:
# print(object)
print(object)
# sendStr = "分享歌曲发生错误:"+object
sendSong()
else:
if object['code'] == 200:
print("分享歌曲成功")
sendStr='云村发表动态成功'
# requests.get('https://sc.ftqq.com/SCU74663T20ed2886a458ab9e3be21f3de4e8fd965e0b13de3ff1b.send?text=云村发表动态成功')
else:
print("分享歌曲失败")
sendStr='云村发表动态失败'
sendSong()
# 分享到朋友圈
res=s.post(url=url5, data=protect('{"type":"2"}'), headers=headers)
object=json.loads(res.text)
# print(object)
if object['code'] != 200 and object['code'] != -2:
print("分享朋友圈发生错误:"+object['msg'])
else:
if object['code'] == 200:
print("分享朋友圈成功")
shareStr='云村分享朋友圈成功'
# requests.get('https://sc.ftqq.com/SCU74663T20ed2886a458ab9e3be21f3de4e8fd965e0b13de3ff1b.send?text=云村分享朋友圈成功')
else:
print("分享朋友圈失败")
shareStr='分享朋友圈失败'
res=s.post(url=url3, data=protect(
'{"csrf_token":"'+requests.utils.dict_from_cookiejar(tempcookie)['__csrf']+'"}'), headers=headers)
object=json.loads(res.text, strict=False)
for x in object['recommend']:
url='https://music.163.com/weapi/v3/playlist/detail?csrf_token=' + \
requests.utils.dict_from_cookiejar(tempcookie)['__csrf']
data={
'id': x['id'],
'n': 1000,
'csrf_token': requests.utils.dict_from_cookiejar(tempcookie)['__csrf'],
}
res=s.post(url, protect(json.dumps(data)), headers=headers)
object=json.loads(res.text, strict=False)
buffer=[]
count=0
for j in object['playlist']['trackIds']:
data2={}
data2["action"]="play"
data2["json"]={}
data2["json"]["download"]=0
data2["json"]["end"]="playend"
data2["json"]["id"]=j["id"]
data2["json"]["sourceId"]=""
data2["json"]["time"]="240"
data2["json"]["type"]="song"
data2["json"]["wifi"]=0
buffer.append(data2)
count += 1
if count >= 510:
break
if count >= 510:
break
url="http://music.163.com/weapi/feedback/weblog"
postdata={
"logs": json.dumps(buffer)
}
res=s.post(url, protect(json.dumps(postdata)))
object=json.loads(res.text, strict=False)
if object['code'] == 200:
print("刷单成功!共"+str(count)+"首")
shuaStr="刷单成功!共"+str(count)+"首"
# exit()
else:
print("发生错误:"+str(object['code'])+object['message'])
shuaStr="发生错误:"+str(object['code'])+object['message']
# exit(object['code'])
now_time = datetime.datetime.now()
bj_time = now_time + datetime.timedelta(hours=8)
desp = f"""
------
### 🚁Now:
```
{bj_time.strftime("%Y-%m-%d %H:%M:%S %p")}
```
### ✨签到:
```
移动端签到:{osSign}
PC端签到:{pcSign}
```
### 🚀动态分享:
```
发表动态:{sendStr}
分享朋友圈:{shareStr}
```
### 🚀刷歌:
```
{shuaStr}
```
"""
requests.post('https://sc.ftqq.com/'+key+'.send', data={
'text':bj_time.strftime("%Y-%m-%d %H:%M:%S %p")+'网易云打卡',
'desp':desp
})