mirror of
https://github.com/0-8-4/miui-auto-tasks.git
synced 2024-11-16 04:35:51 +00:00
[REF] 重构代码以符合 PEP 8 的要求 (#18)
This commit is contained in:
parent
233a94db09
commit
582ca157dc
401
miuitask.py
401
miuitask.py
@ -10,108 +10,109 @@ from http import cookiejar
|
||||
# 小米ID
|
||||
mid = ''
|
||||
# 小米账号的密码MD5值,请使用"passwd2md5.py"转换
|
||||
pMd5 = ''
|
||||
p_md5 = ''
|
||||
# 避免登录失败,如果上面的md5中有小写字母,转换为大写
|
||||
pMd5 = pMd5.upper()
|
||||
p_md5 = p_md5.upper()
|
||||
# 如果登录一直需要短信验证码,在此填入设备id(在account.xiaomi.com的cookie中寻找deviceId)
|
||||
devId = ''
|
||||
dev_id = ''
|
||||
# 常用浏览器UA
|
||||
# 需要改成你自己常用的浏览器的UA
|
||||
lUa = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73'
|
||||
l_ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 ' \
|
||||
'Safari/537.36 Edg/92.0.902.73 '
|
||||
# 开发版内测5428803 开发版公测5433318 稳定版内测5462204 目前测试三个中完成任意一个即可全部完成
|
||||
boardId = '5428803'
|
||||
board_id = '5428803'
|
||||
# 留空
|
||||
cookie = ''
|
||||
# 留空
|
||||
miui_vip_ph = ''
|
||||
|
||||
|
||||
def wLog(text):
|
||||
def w_log(text):
|
||||
now_localtime = time.strftime("%H:%M:%S", time.localtime())
|
||||
print(now_localtime + ' | ' + str(text))
|
||||
|
||||
|
||||
def thumbUp():
|
||||
def thumb_up():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/post/thumbUp?postId=28270729', headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("点赞失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("点赞失败:" + str(rJson['message']))
|
||||
wLog("点赞成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("点赞失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("点赞失败:" + str(r_json['message']))
|
||||
w_log("点赞成功")
|
||||
except:
|
||||
wLog("点赞出错")
|
||||
w_log("点赞出错")
|
||||
|
||||
|
||||
def cancelThumbUp():
|
||||
def cancel_thumb_up():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/post/cancelThumbUp?postId=28270729',
|
||||
headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("取消点赞失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("取消点赞失败:" + str(rJson['message']))
|
||||
wLog("取消点赞成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("取消点赞失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("取消点赞失败:" + str(r_json['message']))
|
||||
w_log("取消点赞成功")
|
||||
except:
|
||||
wLog("取消点赞出错")
|
||||
w_log("取消点赞出错")
|
||||
|
||||
|
||||
def deletePost(tid):
|
||||
def delete_post(tid):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/post/detail/delete?postId=' + str(tid),
|
||||
headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("删除内容失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("删除内容失败:" + str(rJson['message']))
|
||||
wLog("删除内容成功:" + str(rJson['message']))
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("删除内容失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("删除内容失败:" + str(r_json['message']))
|
||||
w_log("删除内容成功:" + str(r_json['message']))
|
||||
except:
|
||||
wLog("删除内容出错,请手动删除")
|
||||
w_log("删除内容出错,请手动删除")
|
||||
|
||||
|
||||
# 发帖
|
||||
def newAnnounce(tType):
|
||||
def new_announce(t_type):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
data = {
|
||||
'announce': '{"textContent":"小米社区闪退","boards":[{"boardId":"' + boardId + '"}],"announceType":"' + str(
|
||||
tType) + '"}',
|
||||
'announce': '{"textContent":"小米社区闪退","boards":[{"boardId":"' + board_id + '"}],"announceType":"' + str(
|
||||
t_type) + '"}',
|
||||
'miui_vip_ph': str(miui_vip_ph)
|
||||
}
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/api/community/post/add/newAnnounce', headers=headers,
|
||||
data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("发表内容失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("发表内容失败:" + str(rJson['message']))
|
||||
postEntity = json.loads(rJson['entity'])
|
||||
wLog("发表内容成功,帖子ID:" + str(postEntity['announceId']) + ",将在3秒后删除")
|
||||
addCommentReturnCommentInfo(str(postEntity['announceId']))
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("发表内容失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("发表内容失败:" + str(r_json['message']))
|
||||
post_entity = json.loads(r_json['entity'])
|
||||
w_log("发表内容成功,帖子ID:" + str(post_entity['announceId']) + ",将在3秒后删除")
|
||||
add_comment_return_comment_info(str(post_entity['announceId']))
|
||||
time.sleep(3)
|
||||
# 执行5次删帖是为了防止删帖失败
|
||||
for i in range(0, 5):
|
||||
deletePost(postEntity['announceId'])
|
||||
for item in range(0, 5):
|
||||
delete_post(post_entity['announceId'])
|
||||
except:
|
||||
wLog("发表内容出错")
|
||||
w_log("发表内容出错")
|
||||
|
||||
|
||||
# 回帖
|
||||
def addCommentReturnCommentInfo(tid):
|
||||
def add_comment_return_comment_info(tid):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
@ -123,30 +124,30 @@ def addCommentReturnCommentInfo(tid):
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/mtop/planet/vip/content/addCommentReturnCommentInfo',
|
||||
headers=headers, data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("回复失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("回复失败:" + str(rJson['message']))
|
||||
wLog("回复成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("回复失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("回复失败:" + str(r_json['message']))
|
||||
w_log("回复成功")
|
||||
except:
|
||||
wLog("回复出错")
|
||||
w_log("回复出错")
|
||||
|
||||
|
||||
def getVipCookie(url):
|
||||
def get_vip_cookie(url):
|
||||
global cookie
|
||||
global miui_vip_ph
|
||||
try:
|
||||
rCookie = cookiejar.CookieJar()
|
||||
handler = request.HTTPCookieProcessor(rCookie)
|
||||
r_cookie = cookiejar.CookieJar()
|
||||
handler = request.HTTPCookieProcessor(r_cookie)
|
||||
opener = request.build_opener(handler)
|
||||
response = opener.open(url)
|
||||
for item in rCookie:
|
||||
for item in r_cookie:
|
||||
cookie += item.name + '=' + item.value + ';'
|
||||
if cookie == '':
|
||||
return False
|
||||
cklist = cookie.replace(" ", "").split(';')
|
||||
for ph in cklist:
|
||||
ck_list = cookie.replace(" ", "").split(';')
|
||||
for ph in ck_list:
|
||||
if "miui_vip_ph=" in ph:
|
||||
miui_vip_ph = ph.replace("miui_vip_ph=", "")
|
||||
break
|
||||
@ -156,7 +157,7 @@ def getVipCookie(url):
|
||||
|
||||
|
||||
# 提交满意度问卷
|
||||
def submitSurvey(sid):
|
||||
def submit_survey(sid):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
@ -167,57 +168,57 @@ def submitSurvey(sid):
|
||||
}
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/api/miui/dev/survey/submit', headers=headers, data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("满意度投票失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("满意度投票失败:" + str(rJson['message']))
|
||||
wLog("满意度投票成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("满意度投票失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("满意度投票失败:" + str(r_json['message']))
|
||||
w_log("满意度投票成功")
|
||||
except:
|
||||
wLog("满意度投票出错")
|
||||
w_log("满意度投票出错")
|
||||
|
||||
|
||||
# 获取满意度投票问卷ID
|
||||
def getSurveyId():
|
||||
def get_survey_id():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/miui/dev/survey?businessId=2', headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("获取问卷ID失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("获取问卷ID失败:" + str(rJson['message']))
|
||||
elif rJson['entity']['surveyInfo']['surveyId'] is None:
|
||||
wLog("获取问卷ID失败:问卷ID为空")
|
||||
surveyId = rJson['entity']['surveyInfo']['surveyId']
|
||||
wLog("获取问卷ID成功:" + str(surveyId))
|
||||
submitSurvey(surveyId)
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("获取问卷ID失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("获取问卷ID失败:" + str(r_json['message']))
|
||||
elif r_json['entity']['surveyInfo']['surveyId'] is None:
|
||||
w_log("获取问卷ID失败:问卷ID为空")
|
||||
survey_id = r_json['entity']['surveyInfo']['surveyId']
|
||||
w_log("获取问卷ID成功:" + str(survey_id))
|
||||
submit_survey(survey_id)
|
||||
except:
|
||||
wLog("获取问卷ID出错,满意度投票失败")
|
||||
w_log("获取问卷ID出错,满意度投票失败")
|
||||
|
||||
|
||||
# 取关用户
|
||||
def unfollowUser():
|
||||
def unfollow_user():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/user/relation/unfollow?followeeId=210836962',
|
||||
headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("取关用户失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("取关用户失败:" + str(rJson['message']))
|
||||
wLog("取关用户成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("取关用户失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("取关用户失败:" + str(r_json['message']))
|
||||
w_log("取关用户成功")
|
||||
except:
|
||||
wLog("取关用户出错")
|
||||
w_log("取关用户出错")
|
||||
|
||||
|
||||
# 关注用户
|
||||
def followUser():
|
||||
def follow_user():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
@ -226,96 +227,97 @@ def followUser():
|
||||
headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("关注用户失败:Cookie无效")
|
||||
return w_log("关注用户失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("关注用户失败:" + str(rJson['message']))
|
||||
wLog("关注用户成功")
|
||||
return w_log("关注用户失败:" + str(rJson['message']))
|
||||
w_log("关注用户成功")
|
||||
except:
|
||||
wLog("关注用户出错")
|
||||
w_log("关注用户出错")
|
||||
|
||||
|
||||
# 退出圈子
|
||||
def unfollowBoard():
|
||||
def unfollow_board():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/board/unfollow?boardId=5462662',
|
||||
headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("退出圈子失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("退出圈子失败:" + str(rJson['message']))
|
||||
wLog("退出圈子成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("退出圈子失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("退出圈子失败:" + str(r_json['message']))
|
||||
w_log("退出圈子成功")
|
||||
except:
|
||||
wLog("退出圈子出错")
|
||||
w_log("退出圈子出错")
|
||||
|
||||
|
||||
# 加入圈子
|
||||
def followBoard():
|
||||
def follow_board():
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
try:
|
||||
response = requests.get('https://api.vip.miui.com/api/community/board/follow?boardId=5462662', headers=headers)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("加入圈子失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("加入圈子失败:" + str(rJson['message']))
|
||||
wLog("加入圈子成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("加入圈子失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("加入圈子失败:" + str(r_json['message']))
|
||||
w_log("加入圈子成功")
|
||||
except:
|
||||
wLog("加入圈子出错")
|
||||
w_log("加入圈子出错")
|
||||
|
||||
|
||||
# 活跃度任务领取
|
||||
def startTask(taskId):
|
||||
def start_task(task_id):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
data = {
|
||||
'taskId': str(taskId),
|
||||
'taskId': str(task_id),
|
||||
'miui_vip_ph': str(miui_vip_ph)
|
||||
}
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/api/community/user/task/start?version=dev.210805',
|
||||
headers=headers, data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("开始活跃分任务失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("开始活跃分任务失败:" + str(rJson['message']))
|
||||
wLog("开始活跃分任务成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("开始活跃分任务失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("开始活跃分任务失败:" + str(r_json['message']))
|
||||
w_log("开始活跃分任务成功")
|
||||
except:
|
||||
wLog("开始活跃分任务出错")
|
||||
w_log("开始活跃分任务出错")
|
||||
|
||||
|
||||
# 活跃度任务完成
|
||||
def acquireTask(taskId):
|
||||
def acquire_task(task_id):
|
||||
headers = {
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
data = {
|
||||
'taskId': str(taskId),
|
||||
'taskId': str(task_id),
|
||||
'miui_vip_ph': str(miui_vip_ph)
|
||||
}
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/api/community/user/task/acquire?version=dev.210805',
|
||||
headers=headers, data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("领取活跃分失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("领取活跃分失败:" + str(rJson['message']))
|
||||
wLog("领取活跃分成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("领取活跃分失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("领取活跃分失败:" + str(r_json['message']))
|
||||
w_log("领取活跃分成功")
|
||||
except:
|
||||
wLog("领取活跃分出错")
|
||||
w_log("领取活跃分出错")
|
||||
|
||||
|
||||
# 社区拔萝卜签到
|
||||
def vipsignin():
|
||||
def vip_sign_in():
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
'cookie': str(cookie)
|
||||
}
|
||||
data = {
|
||||
@ -324,28 +326,38 @@ def vipsignin():
|
||||
try:
|
||||
response = requests.post('https://api.vip.miui.com/api/carrot/pull', headers=headers,
|
||||
data=data)
|
||||
rJson = response.json()
|
||||
if rJson['code'] == 401:
|
||||
return wLog("社区拔萝卜签到失败:Cookie无效")
|
||||
elif rJson['code'] != 200:
|
||||
return wLog("社区拔萝卜签到失败:" + str(rJson['message']))
|
||||
wLog("社区拔萝卜签到成功")
|
||||
r_json = response.json()
|
||||
if r_json['code'] == 401:
|
||||
return w_log("社区拔萝卜签到失败:Cookie无效")
|
||||
elif r_json['code'] != 200:
|
||||
return w_log("社区拔萝卜签到失败:" + str(r_json['message']))
|
||||
w_log("社区拔萝卜签到成功")
|
||||
except:
|
||||
wLog("社区拔萝卜签到出错")
|
||||
w_log("社区拔萝卜签到出错")
|
||||
|
||||
|
||||
def milogin():
|
||||
def mi_login():
|
||||
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=',
|
||||
'User-Agent': str(lUa),
|
||||
'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=',
|
||||
'User-Agent': str(l_ua),
|
||||
'Origin': 'https://account.xiaomi.com',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Cookie': 'deviceId=' + str(devId) + '; pass_ua=web; uLocale=zh_CN'
|
||||
'Cookie': 'deviceId=' + str(dev_id) + '; pass_ua=web; uLocale=zh_CN'
|
||||
}
|
||||
data = {
|
||||
'bizDeviceType': '',
|
||||
@ -353,90 +365,95 @@ def milogin():
|
||||
'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',
|
||||
'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=',
|
||||
'user': str(mid),
|
||||
'cc': '+86',
|
||||
'hash': str(pMd5),
|
||||
'hash': str(p_md5),
|
||||
'_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('&')
|
||||
rJson = json.loads(response_data)
|
||||
if rJson['code'] == 70016:
|
||||
wLog('小米账号登录失败:用户名或密码不正确')
|
||||
r_json = json.loads(response_data)
|
||||
if r_json['code'] == 70016:
|
||||
w_log('小米账号登录失败:用户名或密码不正确')
|
||||
return False
|
||||
if rJson['code'] != 0:
|
||||
wLog('小米账号登录失败:' + rJson['desc'])
|
||||
if r_json['code'] != 0:
|
||||
w_log('小米账号登录失败:' + r_json['desc'])
|
||||
return False
|
||||
if rJson['pwd'] != 1:
|
||||
wLog('当前账号需要短信验证码,请尝试修改UA或设备ID')
|
||||
if r_json['pwd'] != 1:
|
||||
w_log('当前账号需要短信验证码,请尝试修改UA或设备ID')
|
||||
return False
|
||||
if not getVipCookie(rJson['location']):
|
||||
wLog('小米账号登录成功,社区获取 Cookie 失败')
|
||||
if not get_vip_cookie(r_json['location']):
|
||||
w_log('小米账号登录成功,社区获取 Cookie 失败')
|
||||
return False
|
||||
wLog('账号登录完成')
|
||||
w_log('账号登录完成')
|
||||
return True
|
||||
except:
|
||||
wLog("登录小米账号出错")
|
||||
w_log("登录小米账号出错")
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
wLog("MIUITask_v1.2.2")
|
||||
wLog('----------系统信息-开始-------------')
|
||||
w_log("MIUITask_v1.2.2")
|
||||
w_log('----------系统信息-开始-------------')
|
||||
system_info.system_info()
|
||||
wLog('----------系统信息-结束-------------')
|
||||
wLog("项目地址:https://github.com/0-8-4/miui-auto-tasks")
|
||||
wLog("欢迎star,感谢東雲研究所中的大佬")
|
||||
wLog("开始登录小米账号")
|
||||
if milogin():
|
||||
wLog("本脚本支持社区签到,因该功能存在风险默认禁用")
|
||||
wLog("如您愿意承担一切可能的后果,可编辑脚本手动打开该功能")
|
||||
w_log('----------系统信息-结束-------------')
|
||||
w_log("项目地址:https://github.com/0-8-4/miui-auto-tasks")
|
||||
w_log("欢迎star,感谢東雲研究所中的大佬")
|
||||
w_log("开始登录小米账号")
|
||||
if mi_login():
|
||||
w_log("本脚本支持社区签到,因该功能存在风险默认禁用")
|
||||
w_log("如您愿意承担一切可能的后果,可编辑脚本手动打开该功能")
|
||||
# wLog("风险功能提示:正在进行社区签到")
|
||||
# vipsignin()
|
||||
# 警告:根据小米社区规则,非正常渠道签到可能会导致账户封禁
|
||||
# 本脚本虽是模拟您的操作向社区发送请求,但仍不能保证绝对安全
|
||||
# 如果您愿意自行承担一切风险,删去Line400和401"#"即可
|
||||
startTask("10106263")
|
||||
wLog("正在完成BUG反馈任务")
|
||||
newAnnounce("7")
|
||||
wLog("3秒后执行提建议任务")
|
||||
acquireTask("10106263")
|
||||
start_task("10106263")
|
||||
w_log("正在完成BUG反馈任务")
|
||||
new_announce("7")
|
||||
w_log("3秒后执行提建议任务")
|
||||
acquire_task("10106263")
|
||||
time.sleep(3)
|
||||
wLog("正在完成提建议任务")
|
||||
newAnnounce("6")
|
||||
wLog("正在完成满意度调查任务")
|
||||
getSurveyId()
|
||||
wLog("正在完成点赞任务")
|
||||
startTask("10106256")
|
||||
w_log("正在完成提建议任务")
|
||||
new_announce("6")
|
||||
w_log("正在完成满意度调查任务")
|
||||
get_survey_id()
|
||||
w_log("正在完成点赞任务")
|
||||
start_task("10106256")
|
||||
for i in range(0, 5):
|
||||
thumbUp()
|
||||
thumb_up()
|
||||
time.sleep(0.2)
|
||||
cancelThumbUp()
|
||||
cancel_thumb_up()
|
||||
time.sleep(0.2)
|
||||
acquireTask("10106256")
|
||||
wLog("正在完成活跃分_关注任务")
|
||||
startTask("10106261")
|
||||
unfollowUser()
|
||||
followUser()
|
||||
wLog("5秒后领取活跃分_关注任务")
|
||||
acquire_task("10106256")
|
||||
w_log("正在完成活跃分_关注任务")
|
||||
start_task("10106261")
|
||||
unfollow_user()
|
||||
follow_user()
|
||||
w_log("5秒后领取活跃分_关注任务")
|
||||
time.sleep(5)
|
||||
acquireTask("10106261")
|
||||
wLog("正在完成活跃分_加圈任务")
|
||||
startTask("10106262")
|
||||
unfollowBoard()
|
||||
followBoard()
|
||||
wLog("5秒后领取活跃分_加圈任务")
|
||||
acquire_task("10106261")
|
||||
w_log("正在完成活跃分_加圈任务")
|
||||
start_task("10106262")
|
||||
unfollow_board()
|
||||
follow_board()
|
||||
w_log("5秒后领取活跃分_加圈任务")
|
||||
time.sleep(5)
|
||||
acquireTask("10106262")
|
||||
wLog("正在完成活跃分_发帖任务")
|
||||
startTask("10106265")
|
||||
newAnnounce("5")
|
||||
wLog("5秒后领取活跃分_发帖任务")
|
||||
acquire_task("10106262")
|
||||
w_log("正在完成活跃分_发帖任务")
|
||||
start_task("10106265")
|
||||
new_announce("5")
|
||||
w_log("5秒后领取活跃分_发帖任务")
|
||||
time.sleep(5)
|
||||
acquireTask("10106265")
|
||||
acquire_task("10106265")
|
||||
|
@ -1,8 +1,8 @@
|
||||
from hashlib import md5
|
||||
|
||||
mipasswd = 'mypassword'
|
||||
# 请将"mypassword"改为你的小米账号密码
|
||||
md5_mipasswd = md5(mipasswd.encode('utf8')).hexdigest()
|
||||
mi_passwd = 'my_password'
|
||||
# 请将"my_password"改为你的小米账号密码
|
||||
md5_mi_passwd = md5(mi_passwd.encode('utf8')).hexdigest()
|
||||
# 利用hashlib模块本地计算md5
|
||||
print(md5_mipasswd)
|
||||
print(md5_mi_passwd)
|
||||
# 输出
|
||||
|
@ -8,15 +8,15 @@ def show_info(tip, info):
|
||||
|
||||
|
||||
def system_info():
|
||||
miuitask.wLog(show_info("系统及版本信息", platform.platform()))
|
||||
miuitask.wLog(show_info('系统版本号', platform.version()))
|
||||
miuitask.wLog(show_info('系统名称', platform.system()))
|
||||
miuitask.wLog(show_info('系统位数', platform.architecture()))
|
||||
miuitask.wLog(show_info('计算机类型', platform.machine()))
|
||||
miuitask.wLog(show_info('处理器类型', platform.processor()))
|
||||
miuitask.wLog(show_info('Python版本', str(platform.python_version()) + ' ' + str(platform.python_build())))
|
||||
miuitask.w_log(show_info("系统及版本信息", platform.platform()))
|
||||
miuitask.w_log(show_info('系统版本号', platform.version()))
|
||||
miuitask.w_log(show_info('系统名称', platform.system()))
|
||||
miuitask.w_log(show_info('系统位数', platform.architecture()))
|
||||
miuitask.w_log(show_info('计算机类型', platform.machine()))
|
||||
miuitask.w_log(show_info('处理器类型', platform.processor()))
|
||||
miuitask.w_log(show_info('Python版本', str(platform.python_version()) + ' ' + str(platform.python_build())))
|
||||
if getproxies():
|
||||
miuitask.wLog(show_info('系统代理', getproxies()))
|
||||
miuitask.w_log(show_info('系统代理', getproxies()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user