2021-08-16 03:39:26 +00:00
|
|
|
|
# -- coding:UTF-8 --
|
|
|
|
|
import requests
|
|
|
|
|
import time
|
|
|
|
|
import json
|
2021-10-26 16:35:08 +00:00
|
|
|
|
import hashlib
|
2021-08-16 03:39:26 +00:00
|
|
|
|
|
|
|
|
|
from urllib import request
|
|
|
|
|
from http import cookiejar
|
2021-12-24 13:53:40 +00:00
|
|
|
|
|
|
|
|
|
from utils.utils import system_info, get_config, w_log, s_log, check_config, format_config
|
2021-08-16 03:39:26 +00:00
|
|
|
|
|
2021-09-06 21:52:48 +00:00
|
|
|
|
|
2021-09-17 00:08:26 +00:00
|
|
|
|
class MIUITask:
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
def __init__(self, uid, password, user_agent, device_id):
|
2021-12-24 13:53:40 +00:00
|
|
|
|
self.uid = uid
|
|
|
|
|
self.password = password
|
|
|
|
|
self.user_agent = user_agent
|
|
|
|
|
self.device_id = device_id
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
# 留空
|
|
|
|
|
self.cookie = ''
|
|
|
|
|
# 留空
|
|
|
|
|
self.miui_vip_ph = ''
|
2021-10-26 16:35:08 +00:00
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 签名
|
2021-10-26 16:35:08 +00:00
|
|
|
|
def post_sign(self,data):
|
|
|
|
|
s_data = []
|
|
|
|
|
for d in data:
|
|
|
|
|
s_data.append(str(d) + '=' + str(data[d]))
|
|
|
|
|
s_str = '&'.join(s_data)
|
|
|
|
|
w_log('签名原文:' + str(s_str))
|
|
|
|
|
s_str = hashlib.md5(str(s_str).encode(encoding='UTF-8')).hexdigest() + '067f0q5wds4'
|
|
|
|
|
s_sign = hashlib.md5(str(s_str).encode(encoding='UTF-8')).hexdigest()
|
|
|
|
|
w_log('签名结果:' + str(s_sign))
|
|
|
|
|
return s_sign, data['timestamp']
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 点赞
|
|
|
|
|
def thumb_up(self):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
headers = {
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
2021-10-26 16:35:08 +00:00
|
|
|
|
sign_data = {
|
2022-08-22 00:17:35 +00:00
|
|
|
|
'postId': '36625780',
|
2021-10-26 16:35:08 +00:00
|
|
|
|
'timestamp': int(round(time.time() * 1000))
|
|
|
|
|
}
|
|
|
|
|
sign = self.post_sign(sign_data)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
data = {
|
2022-08-22 00:17:35 +00:00
|
|
|
|
'postId': '36625780',
|
2021-10-26 16:35:08 +00:00
|
|
|
|
'sign': sign[0],
|
|
|
|
|
'timestamp': sign[1]
|
2021-09-17 00:08:26 +00:00
|
|
|
|
}
|
|
|
|
|
try:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/content/announceThumbUp', headers=headers,
|
|
|
|
|
params=data)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
r_json = response.json()
|
|
|
|
|
if r_json['code'] == 401:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("点赞失败:Cookie无效")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
elif r_json['code'] != 200:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("点赞失败:" + str(r_json['message']))
|
|
|
|
|
w_log("点赞成功")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
except Exception as e:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
w_log("点赞出错")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log(e)
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 取消点赞
|
|
|
|
|
def cancel_thumb_up(self):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
headers = {
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
|
|
|
|
try:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
response = requests.get('https://api.vip.miui.com/api/community/post/cancelThumbUp?postId=36625780',
|
|
|
|
|
headers=headers)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
r_json = response.json()
|
|
|
|
|
if r_json['code'] == 401:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("取消点赞失败:Cookie无效")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
elif r_json['code'] != 200:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("取消点赞失败:" + str(r_json['message']))
|
|
|
|
|
w_log("取消点赞成功")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
except Exception as e:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
w_log("取消点赞出错")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log(e)
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
|
2021-09-17 00:08:26 +00:00
|
|
|
|
def get_vip_cookie(self, url):
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
r_cookie = cookiejar.CookieJar()
|
|
|
|
|
handler = request.HTTPCookieProcessor(r_cookie)
|
|
|
|
|
opener = request.build_opener(handler)
|
|
|
|
|
response = opener.open(url)
|
|
|
|
|
for item in r_cookie:
|
|
|
|
|
self.cookie += item.name + '=' + item.value + ';'
|
|
|
|
|
if self.cookie == '':
|
|
|
|
|
return False
|
|
|
|
|
ck_list = self.cookie.replace(" ", "").split(';')
|
|
|
|
|
for ph in ck_list:
|
|
|
|
|
if "miui_vip_ph=" in ph:
|
|
|
|
|
self.miui_vip_ph = ph.replace("miui_vip_ph=", "")
|
|
|
|
|
break
|
|
|
|
|
return True
|
|
|
|
|
except Exception as e:
|
|
|
|
|
w_log(e)
|
2021-08-16 03:39:26 +00:00
|
|
|
|
return False
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 浏览帖子10s
|
|
|
|
|
def browse_post(self):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
headers = {
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
2022-08-22 00:17:35 +00:00
|
|
|
|
params = {
|
|
|
|
|
'userId': str(self.uid),
|
|
|
|
|
'action': 'BROWSE_POST_10S',
|
2021-09-17 00:08:26 +00:00
|
|
|
|
}
|
|
|
|
|
try:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/member/addCommunityGrowUpPointByAction', params=params, headers=headers)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
r_json = response.json()
|
2022-08-22 00:17:35 +00:00
|
|
|
|
if r_json['status'] == 401:
|
|
|
|
|
return w_log("浏览帖子失败:Cookie无效")
|
|
|
|
|
elif r_json['status'] != 200:
|
|
|
|
|
return w_log("浏览帖子完成,但有错误:" + str(r_json['message']))
|
|
|
|
|
score = r_json['entity']['score']
|
|
|
|
|
w_log("浏览帖子完成,成长值+" + str(score))
|
2021-09-17 00:08:26 +00:00
|
|
|
|
except Exception as e:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
w_log("浏览帖子出错")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log(e)
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 社区拔萝卜
|
2022-08-25 16:26:04 +00:00
|
|
|
|
def carrot_pull(self):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
headers = {
|
2022-08-22 00:17:35 +00:00
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
|
2021-09-17 00:08:26 +00:00
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
|
|
|
|
data = {
|
|
|
|
|
'miui_vip_ph': str(self.miui_vip_ph)
|
|
|
|
|
}
|
|
|
|
|
try:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
response = requests.post('https://api.vip.miui.com/api/carrot/pull', headers=headers,
|
|
|
|
|
data=data)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
r_json = response.json()
|
|
|
|
|
if r_json['code'] == 401:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("社区拔萝卜失败:Cookie无效")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
elif r_json['code'] != 200:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
return w_log("社区拔萝卜失败:" + str(r_json['entity']['message']))
|
|
|
|
|
w_log("社区拔萝卜结果:" + str(r_json['entity']['message']))
|
|
|
|
|
money_count = r_json['entity']['header']['moneyCount']
|
|
|
|
|
w_log("当前金币数:" + str(money_count))
|
2021-09-17 00:08:26 +00:00
|
|
|
|
except Exception as e:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
w_log("社区拔萝卜出错")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log(e)
|
|
|
|
|
|
2022-08-22 00:17:35 +00:00
|
|
|
|
# 社区4.0签到
|
|
|
|
|
def check_in(self):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
headers = {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
|
|
|
|
try:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/user/checkin?pathname=/mio/checkIn&version=dev.1144', headers=headers)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
r_json = response.json()
|
2022-08-22 00:17:35 +00:00
|
|
|
|
if r_json['status'] == 401:
|
|
|
|
|
return w_log("社区成长值签到失败:Cookie无效")
|
|
|
|
|
elif r_json['status'] != 200:
|
|
|
|
|
return w_log("社区成长值签到失败:" + str(r_json['message']))
|
|
|
|
|
w_log("社区成长值签到结果:成长值+" + str(r_json['entity']))
|
2021-09-17 00:08:26 +00:00
|
|
|
|
except Exception as e:
|
2022-08-22 00:17:35 +00:00
|
|
|
|
w_log("社区成长值签到出错")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log(e)
|
|
|
|
|
|
2022-08-25 16:26:04 +00:00
|
|
|
|
# 登录社区App
|
|
|
|
|
def login_app(self):
|
|
|
|
|
headers = {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
|
|
|
|
try:
|
|
|
|
|
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/app/init/start/infos', headers=headers)
|
|
|
|
|
r_code = response.status_code
|
|
|
|
|
if r_code == 401:
|
|
|
|
|
return w_log("登录社区App失败:Cookie无效")
|
|
|
|
|
elif r_code != 200:
|
|
|
|
|
return w_log("登录社区App失败")
|
|
|
|
|
w_log("登录社区App成功")
|
|
|
|
|
except Exception as e:
|
|
|
|
|
w_log("登录社区App出错")
|
|
|
|
|
w_log(e)
|
|
|
|
|
|
2021-09-17 00:08:26 +00:00
|
|
|
|
def mi_login(self):
|
|
|
|
|
proxies = {
|
|
|
|
|
'https': None,
|
|
|
|
|
'http': None
|
|
|
|
|
}
|
|
|
|
|
headers = {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
|
|
|
'Referer': 'https://account.xiaomi.com/fe/service/login/password?sid=miui_vip&qs=%253Fcallback%253Dhttp'
|
|
|
|
|
'%25253A%25252F%25252Fapi.vip.miui.com%25252Fsts%25253Fsign%25253D4II4ABwZkiJzkd2YSkyEZukI4Ak'
|
|
|
|
|
'%2525253D%252526followup%25253Dhttps%2525253A%2525252F%2525252Fapi.vip.miui.com%2525252Fpage'
|
|
|
|
|
'%2525252Flogin%2525253FdestUrl%2525253Dhttps%252525253A%252525252F%252525252Fweb.vip.miui.com'
|
|
|
|
|
'%252525252Fpage%252525252Finfo%252525252Fmio%252525252Fmio%252525252FinternalTest%252525253Fref'
|
|
|
|
|
'%252525253Dhomepage%2526sid%253Dmiui_vip&callback=http%3A%2F%2Fapi.vip.miui.com%2Fsts%3Fsign'
|
|
|
|
|
'%3D4II4ABwZkiJzkd2YSkyEZukI4Ak%253D%26followup%3Dhttps%253A%252F%252Fapi.vip.miui.com%252Fpage'
|
|
|
|
|
'%252Flogin%253FdestUrl%253Dhttps%25253A%25252F%25252Fweb.vip.miui.com%25252Fpage%25252Finfo'
|
|
|
|
|
'%25252Fmio%25252Fmio%25252FinternalTest%25253Fref%25253Dhomepage&_sign=L%2BdSQY6sjSQ%2FCRjJs4p'
|
|
|
|
|
'%2BU1vNYLY%3D&serviceParam=%7B%22checkSafePhone%22%3Afalse%2C%22checkSafeAddress%22%3Afalse%2C'
|
|
|
|
|
'%22lsrp_score%22%3A0.0%7D&showActiveX=false&theme=&needTheme=false&bizDeviceType=',
|
2021-12-24 13:53:40 +00:00
|
|
|
|
'User-Agent': str(self.user_agent),
|
2021-09-17 00:08:26 +00:00
|
|
|
|
'Origin': 'https://account.xiaomi.com',
|
|
|
|
|
'X-Requested-With': 'XMLHttpRequest',
|
2021-12-24 13:53:40 +00:00
|
|
|
|
'Cookie': 'deviceId=' + str(self.device_id) + '; pass_ua=web; uLocale=zh_CN'
|
2021-09-17 00:08:26 +00:00
|
|
|
|
}
|
|
|
|
|
data = {
|
|
|
|
|
'bizDeviceType': '',
|
|
|
|
|
'needTheme': 'false',
|
|
|
|
|
'theme': '',
|
|
|
|
|
'showActiveX': 'false',
|
|
|
|
|
'serviceParam': '{"checkSafePhone":false,"checkSafeAddress":false,"lsrp_score":0.0}',
|
|
|
|
|
'callback': 'http://api.vip.miui.com/sts?sign=4II4ABwZkiJzkd2YSkyEZukI4Ak%3D&followup=https%3A%2F%2Fapi.vip'
|
|
|
|
|
'.miui.com%2Fpage%2Flogin%3FdestUrl%3Dhttps%253A%252F%252Fweb.vip.miui.com%252Fpage%252Finfo'
|
|
|
|
|
'%252Fmio%252Fmio%252FinternalTest%253Fref%253Dhomepage',
|
|
|
|
|
'qs': '%3Fcallback%3Dhttp%253A%252F%252Fapi.vip.miui.com%252Fsts%253Fsign%253D4II4ABwZkiJzkd2YSkyEZukI4Ak'
|
|
|
|
|
'%25253D%2526followup%253Dhttps%25253A%25252F%25252Fapi.vip.miui.com%25252Fpage%25252Flogin'
|
|
|
|
|
'%25253FdestUrl%25253Dhttps%2525253A%2525252F%2525252Fweb.vip.miui.com%2525252Fpage%2525252Finfo'
|
|
|
|
|
'%2525252Fmio%2525252Fmio%2525252FinternalTest%2525253Fref%2525253Dhomepage%26sid%3Dmiui_vip',
|
|
|
|
|
'sid': 'miui_vip',
|
|
|
|
|
'_sign': 'L+dSQY6sjSQ/CRjJs4p+U1vNYLY=',
|
2021-12-24 13:53:40 +00:00
|
|
|
|
'user': str(self.uid),
|
2021-09-17 00:08:26 +00:00
|
|
|
|
'cc': '+86',
|
2021-12-24 13:53:40 +00:00
|
|
|
|
'hash': str(self.password),
|
2021-09-17 00:08:26 +00:00
|
|
|
|
'_json': 'true'
|
|
|
|
|
}
|
|
|
|
|
try:
|
|
|
|
|
response = requests.post('https://account.xiaomi.com/pass/serviceLoginAuth2', headers=headers, data=data,
|
|
|
|
|
proxies=proxies)
|
|
|
|
|
response_data = response.text.lstrip('&').lstrip('START').lstrip('&')
|
|
|
|
|
r_json = json.loads(response_data)
|
|
|
|
|
if r_json['code'] == 70016:
|
|
|
|
|
w_log('小米账号登录失败:用户名或密码不正确')
|
|
|
|
|
return False
|
|
|
|
|
if r_json['code'] != 0:
|
|
|
|
|
w_log('小米账号登录失败:' + r_json['desc'])
|
|
|
|
|
return False
|
|
|
|
|
if r_json['pwd'] != 1:
|
|
|
|
|
w_log('当前账号需要短信验证码,请尝试修改UA或设备ID')
|
|
|
|
|
return False
|
|
|
|
|
if not self.get_vip_cookie(r_json['location']):
|
|
|
|
|
w_log('小米账号登录成功,社区获取 Cookie 失败')
|
|
|
|
|
return False
|
|
|
|
|
w_log('账号登录完成')
|
|
|
|
|
return True
|
|
|
|
|
except Exception as e:
|
|
|
|
|
w_log("登录小米账号出错")
|
|
|
|
|
w_log(e)
|
2021-08-16 03:39:26 +00:00
|
|
|
|
return False
|
|
|
|
|
|
2021-09-17 00:08:26 +00:00
|
|
|
|
def get_score(self) -> int:
|
|
|
|
|
"""
|
2021-12-24 13:53:40 +00:00
|
|
|
|
这个方法带返回值的原因是,可以调用这个方法获取返回值,可根据这个方法定制自己的“消息提示功能”。
|
2021-09-17 00:08:26 +00:00
|
|
|
|
如:Qmsg发送到QQ 或者 发送邮件提醒
|
|
|
|
|
:return: 当前的内测分值
|
|
|
|
|
"""
|
|
|
|
|
headers = {
|
|
|
|
|
'cookie': str(self.cookie)
|
|
|
|
|
}
|
|
|
|
|
try:
|
|
|
|
|
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/betaTest/score', headers=headers)
|
|
|
|
|
r_json = response.json()
|
|
|
|
|
your_score = r_json['entity']
|
|
|
|
|
w_log('成功获取内测分,当前内测分:' + str(your_score))
|
|
|
|
|
return your_score
|
|
|
|
|
except Exception as e:
|
|
|
|
|
w_log('内测分获取失败')
|
|
|
|
|
process_exception(e)
|
2021-09-11 15:28:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def process_exception(e: Exception):
|
|
|
|
|
"""
|
|
|
|
|
全局异常处理
|
|
|
|
|
:param e: 异常实例
|
|
|
|
|
:return: No return
|
|
|
|
|
"""
|
|
|
|
|
if e.__str__() == 'check_hostname requires server_hostname':
|
|
|
|
|
w_log('系统设置了代理,出现异常')
|
|
|
|
|
|
|
|
|
|
|
2022-08-25 16:26:04 +00:00
|
|
|
|
def start(miui_task: MIUITask, check_in: bool, carrot_pull: bool):
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
if miui_task.mi_login():
|
2022-08-25 16:26:04 +00:00
|
|
|
|
w_log("本脚本支持社区拔萝卜及成长值签到,因该功能存在风险默认禁用")
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log("如您愿意承担一切可能的后果,可编辑配置文件手动打开该功能")
|
2022-08-25 16:26:04 +00:00
|
|
|
|
miui_task.login_app()
|
|
|
|
|
if carrot_pull:
|
|
|
|
|
w_log("风险功能提示:正在进行社区拔萝卜")
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
miui_task.carrot_pull()
|
2021-12-24 13:53:40 +00:00
|
|
|
|
if check_in:
|
2022-08-25 16:26:04 +00:00
|
|
|
|
w_log("风险功能提示:正在进行成长值签到")
|
|
|
|
|
time.sleep(0.5)
|
2022-08-22 00:17:35 +00:00
|
|
|
|
miui_task.check_in()
|
|
|
|
|
w_log("正在完成浏览帖子10s任务,第一次")
|
|
|
|
|
time.sleep(10.5)
|
|
|
|
|
miui_task.browse_post()
|
|
|
|
|
w_log("正在完成浏览帖子10s任务,第二次")
|
|
|
|
|
time.sleep(10.5)
|
|
|
|
|
miui_task.browse_post()
|
|
|
|
|
w_log("正在完成浏览帖子10s任务,第三次")
|
|
|
|
|
time.sleep(10.5)
|
|
|
|
|
miui_task.browse_post()
|
2021-09-17 00:08:26 +00:00
|
|
|
|
w_log("正在完成点赞任务")
|
2021-10-26 16:35:08 +00:00
|
|
|
|
miui_task.thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
|
|
|
|
miui_task.cancel_thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
2022-08-22 00:17:35 +00:00
|
|
|
|
miui_task.thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
|
|
|
|
miui_task.cancel_thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
|
|
|
|
miui_task.thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
|
|
|
|
miui_task.cancel_thumb_up()
|
|
|
|
|
time.sleep(0.2)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
miui_task.get_score()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2022-08-25 16:26:04 +00:00
|
|
|
|
w_log("MIUI-AUTO-TASK v1.5.1")
|
2021-12-24 13:53:40 +00:00
|
|
|
|
w_log('---------- 系统信息 -------------')
|
2021-09-06 21:52:48 +00:00
|
|
|
|
system_info()
|
2021-12-24 13:53:40 +00:00
|
|
|
|
w_log('---------- 项目信息 -------------')
|
2021-09-06 18:39:01 +00:00
|
|
|
|
w_log("项目地址:https://github.com/0-8-4/miui-auto-tasks")
|
2021-12-24 13:53:40 +00:00
|
|
|
|
w_log("欢迎 star,感谢東雲研究所中的大佬")
|
|
|
|
|
w_log('---------- 配置检测 -------------')
|
|
|
|
|
|
2021-09-17 00:08:26 +00:00
|
|
|
|
config = get_config()
|
|
|
|
|
|
2021-12-24 13:53:40 +00:00
|
|
|
|
if not check_config(config):
|
|
|
|
|
w_log('配置文件没有正确配置')
|
|
|
|
|
exit(1)
|
|
|
|
|
else:
|
|
|
|
|
config = format_config(config)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
2021-12-24 13:53:40 +00:00
|
|
|
|
for i in config.get('accounts'):
|
|
|
|
|
w_log('---------- EXECUTING -------------')
|
|
|
|
|
start(
|
2022-08-22 00:17:35 +00:00
|
|
|
|
MIUITask(i.get('uid'), i.get('password'), i.get('user-agent'), device_id=i.get('device-id')),
|
2022-08-25 16:26:04 +00:00
|
|
|
|
i.get('check-in'), i.get('carrot-pull'),
|
2021-12-24 13:53:40 +00:00
|
|
|
|
)
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
2021-12-24 13:53:40 +00:00
|
|
|
|
s_log(config.get('logging'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main_handler(event, context):
|
|
|
|
|
main()
|
2021-09-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|