Python版葫芦侠三楼签到工具,可挂云函数
本帖最后由 minshenyao 于 2020-8-14 13:11 编辑感谢@DYTRemix 提供的接口,小白试着整理了一下
来到吾爱发的第一篇帖子,不会弄
大家将就一下
这里填账号密码,不要空格
一样小白,简单加了个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']
globals_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
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)
title = titles
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()
minshenyao 发表于 2020-8-14 11:37
邮箱我没试过,我用的手机号,密码md5加密,32位小,邮箱理论也行
返回数据:
{"errorCode":-1,"errorMessage":"Traceback (most recent call last):\nFile \"/var/runtime/python3/bootstrap.py\", line 133, in init_handler\n func_handler = get_func_handler(file.rsplit(\".\", 1), func)\nFile \"/var/runtime/python3/bootstrap.py\", line 160, in get_func_handler\n return getattr(mod, fname)\nAttributeError: module 'index' has no attribute 'main'"}
日志:
START RequestId: 485d5c64-9003-4089-931f-0e5ec30e20ab
Event RequestId: 485d5c64-9003-4089-931f-0e5ec30e20ab
ERROR RequestId:485d5c64-9003-4089-931f-0e5ec30e20ab Result:{"errorCode":-1,"errorMessage":"Traceback (most recent call last):\nFile \"/var/runtime/python3/bootstrap.py\", line 133, in init_handler\n func_handler = get_func_handler(file.rsplit(\".\", 1), func)\nFile \"/var/runtime/python3/bootstrap.py\", line 160, in get_func_handler\n return getattr(mod, fname)\nAttributeError: module 'index' has no attribute 'main'"}
END RequestId: 485d5c64-9003-4089-931f-0e5ec30e20ab
Report RequestId: 485d5c64-9003-4089-931f-0e5ec30e20ab Duration:0ms Memory:128MB MemUsage:0.000000MB @DYTRemix 来吧
@hewei9 需要环境了么
feiyu361 发表于 2020-8-13 11:34
需要环境了么
挂腾讯云函数就行了,环境是python3 楼主,我这个调用失败,只需要修改邮箱和密码吧。 挂上运行失败呀。除了要改用户名和密码,还需要改哪里吗 minshenyao 发表于 2020-8-13 17:11
挂腾讯云函数就行了,环境是python3
好的,我试试 1228小浣熊 发表于 2020-8-13 22:05
挂上运行失败呀。除了要改用户名和密码,还需要改哪里吗
只需要用户名密码,用户名最好用手机号,密码要md5加密,32位小 KDWJEBE 发表于 2020-8-13 18:20
楼主,我这个调用失败,只需要修改邮箱和密码吧。
邮箱我没试过,我用的手机号,密码md5加密,32位小,邮箱理论也行