好友
阅读权限10
听众
最后登录1970-1-1
|
一样小白,简单加了个server酱推送
import requests
user = '你的账号' #手机号码/邮箱
passwd = ' 你的密码 ' #密码MD5加密(32小)
skey = '' #你的server酱skey
r = requests.Session()
def push(content):
if skey != "":
url = "https://sc.ftqq.com/" + str(skey) + ".send?text=葫芦侠签到信息&desp=" + str(content)
print("推送结果", requests.get(url).text)
def login():
url = 'http://floor.huluxia.com/account/login/ANDROID/4.0?platform=2&gkey=000000&app_version=4.0.0.6.2&versioncode=20141433&market_id=floor_baidu&_key=&device_code=%5Bw%5D02%3A00%3A00%3A00%3A00%3A00'
params = {
'account': user,
'login_type': '2',
'password': passwd
}
login_res = r.post(url=url,data=params)
# print(login_res.text)
login_res = login_res.json()
nick = login_res['user']['nick']
print('登录用户:',nick)
global key
key = login_res['_key']
global s_key
s_key = login_res['session_key']
return key,s_key
def check():
url1 = 'http://floor.huluxia.com/user/status/ANDROID/2.1'
params = {
'platform': '2',
'gkey': '000000',
'app_version': '4.0.0.6.3',
'versioncode': '20141434',
'market_id': 'floor_baidu',
'_key': key,
'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00',
}
check_req = r.get(url=url1,params=params)
# print(check_req.text)
check_req = check_req.json()
status = check_req['status']
if status == 0:
print('令牌验证失败')
elif status == 1:
print('令牌验证成功')
return status
def category():
global titles
global categoryIDs
titles = []
categoryIDs = []
url = 'http://floor.huluxia.com/category/list/ANDROID/2.0'
params = {
'platform': '2',
'gkey': '000000',
'app_version': '4.0.0.6.3',
'versioncode': '20141434',
'market_id': 'floor_huluxia',
'_key': key,
'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00',
'is_hidden': '1'
}
category_res = r.get(url=url,params=params)
# print(category_res.text)
category_res = category_res.json()
category_res = category_res["categories"]
for i in range(3,40):
res = category_res[i]
titles.append(res['title'])
categoryIDs.append(res['categoryID'])
# print(titles)
# print(categoryIDs)
return titles,categoryIDs
def signin():
a = []
url = f'http://floor.huluxia.com/user/signin/ANDROID/4.0'
for i in range(0,37):
IDS = str(categoryIDs[i])
title = titles[i]
params = {
'platform': '2',
'gkey': '000000',
'app_version': '4.0.0.6.3',
'versioncode': '20141434',
'market_id': 'floor_baidu',
'_key': key,
'device_code': '%5Bw%5D02%3A00%3A00%3A00%3A00%3A00',
'cat_id': IDS
}
signin_res = r.get(url=url,params=params)
msg = str(title) +'签到成功'
# print(signin_res)
a.append(msg)
print(a)
push((a))
if __name__ == "__main__":
login()
check()
category()
signin()
def main_handler(event, context):
return login(),check(),category(),signin()
|
|