v1.5.2.1 (#62)

* v1.5.2.1

支持更多任务
更新readme和wiki

* 修复成长值查询

* improve: format too long string

Co-authored-by: 0-8-4 <ljd69154@liangjundi.cn>
This commit is contained in:
TardisX 2022-11-03 21:52:56 +08:00 committed by GitHub
parent c76ee156e5
commit b8551ec6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 16 deletions

View File

@ -42,12 +42,17 @@
- [x] 支持 Docker 部署
- [x] 支持 腾讯云函数 部署
- [x] 自动登录小米账号刷新社区 Cookie 实现自动化
- [x] 选择性启用小米社区拔萝卜签到
- [x] 选择性启用小米社区成长值签到
- [x] 选择性启用参与小米社区拔萝卜
- [x] 选择性启用小米社区每日签到
- [x] 选择性启用小米社区限时专题任务
- [x] 自动完成以下小米社区成长值任务且不留下可见痕迹
- “每日登录小米社区App” 成长值任务
- “浏览帖子超过10秒” 成长值任务
- “点赞他人帖子” 成长值任务
- “浏览个人主页超过10秒” 成长值任务
- “加入小米社区圈子” 成长值任务
&#x26A0; 请注意,修改配置文件开启完成限时专题任务后 MIUI Task 不会检测当前是否可完成限时专题任务而会直接发送请求,根据社区相关规则,启用完成限时专题任务、拔萝卜及签到等可能存在风险。您需要自行承担使用本脚本的后果
#### **其他**

View File

@ -11,13 +11,17 @@ accounts:
check-in: false
# 小米社区成长值签到,可能存在封号风险
# 本脚本默认完成登录社区和三次点赞及三次浏览十秒帖子的成长值任务
browse-specialpage: false
# 小米社区在活动期间可能会出现限时的“浏览指定专题页”任务
# 考虑到安全问题,建议在存在该限时活动手动打开,活动结束时关闭
# 若有多个小米账户,按照以下模板进行修改,使用时删除前端 #注释
# - uid: 100001
# password: abc123
# user-agent: 'Mozilla/5.0 (Android 11; Mobile; rv:95.0) Gecko/95.0 Firefox/95.0'
# carrot-pull: false
# check-in: false
# browse-specialpage: false
logging: false
# 归档日志到本地文件
version: v1.5.1
version: v1.5.2
# config 文件版本号debug用

View File

@ -3,7 +3,6 @@ import requests
import time
import json
import hashlib
import random
from urllib import request
from http import cookiejar
@ -150,6 +149,29 @@ class MIUITask:
w_log("浏览个人主页出错")
w_log(e)
# 浏览指定专题页
def browse_specialpage(self):
headers = {
'cookie': str(self.cookie)
}
params = {
'userId': str(self.uid),
'action': 'BROWSE_SPECIAL_PAGES_SPECIAL_PAGE',
}
try:
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/member/addCommunityGrowUpPointByAction',
params=params, headers=headers)
r_json = response.json()
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))
except Exception as e:
w_log("浏览专题页出错")
w_log(e)
# 加入小米圈子
def board_follow(self):
headers = {
@ -157,7 +179,8 @@ class MIUITask:
}
try:
response = requests.get(
'https://api.vip.miui.com/api/community/board/follow?boardId=5462662&pathname=/mio/singleBoard&version=dev.1144',
'https://api.vip.miui.com/api/community/board/follow?'
'boardId=5462662&pathname=/mio/singleBoard&version=dev.1144',
headers=headers)
r_json = response.json()
if r_json['status'] == 401:
@ -316,23 +339,23 @@ class MIUITask:
w_log(e)
return False
def get_score(self) -> int:
def get_point(self) -> int:
"""
这个方法带返回值的原因是可以调用这个方法获取返回值可根据这个方法定制自己的消息提示功能
Qmsg发送到QQ 或者 发送邮件提醒
:return: 当前的内测分
:return: 当前的成长
"""
headers = {
'cookie': str(self.cookie)
}
try:
response = requests.get('https://api.vip.miui.com/mtop/planet/vip/betaTest/score', headers=headers)
response = requests.get('https://api.vip.miui.com/mtop/planet/pc/post/userInfo', headers=headers)
r_json = response.json()
your_score = r_json['entity']
w_log('成功获取内测分,当前内测分:' + str(your_score))
return your_score
your_point = r_json['entity']['userGrowLevelInfo']['point']
w_log('成功获取成长值,当前成长值:' + str(your_point))
return your_point
except Exception as e:
w_log('内测分获取失败')
w_log('成长值获取失败')
process_exception(e)
@ -346,7 +369,7 @@ def process_exception(e: Exception):
w_log('系统设置了代理,出现异常')
def start(miui_task: MIUITask, check_in: bool, carrot_pull: bool):
def start(miui_task: MIUITask, check_in: bool, carrot_pull: bool, browse_specialpage: bool):
if miui_task.mi_login():
w_log("本脚本支持社区拔萝卜及成长值签到,因该功能存在风险默认禁用")
w_log("如您愿意承担一切可能的后果,可编辑配置文件手动打开该功能")
@ -359,6 +382,10 @@ def start(miui_task: MIUITask, check_in: bool, carrot_pull: bool):
w_log("风险功能提示:正在进行成长值签到")
random_sleep()
miui_task.check_in()
if browse_specialpage:
w_log("风险功能提示正在完成浏览专题页10s任务")
sleep_ten_sec_more()
miui_task.browse_specialpage()
w_log("正在完成浏览帖子10s任务第一次")
sleep_ten_sec_more()
miui_task.browse_post()
@ -386,10 +413,12 @@ def start(miui_task: MIUITask, check_in: bool, carrot_pull: bool):
miui_task.board_follow()
random_sleep()
miui_task.browse_user_page()
random_sleep()
miui_task.get_point()
def main():
w_log("MIUI-AUTO-TASK v1.5.1")
w_log("MIUI-AUTO-TASK v1.5.2")
w_log('---------- 系统信息 -------------')
system_info()
w_log('---------- 项目信息 -------------')
@ -409,7 +438,7 @@ def main():
w_log('---------- EXECUTING -------------')
start(
MIUITask(i.get('uid'), i.get('password'), i.get('user-agent'), device_id=i.get('device-id')),
i.get('check-in'), i.get('carrot-pull'),
i.get('check-in'), i.get('carrot-pull'), i.get('browse-specialpage'),
)
time.sleep(5)
s_log(config.get('logging'))

View File

@ -8,7 +8,7 @@ from hashlib import md5
from urllib.request import getproxies
logs = ''
CONFIG_VERSION_REQUIRE: str = 'v1.5.1'
CONFIG_VERSION_REQUIRE: str = 'v1.5.2'
def md5_crypto(passwd: str) -> str:
@ -51,6 +51,10 @@ def get_config() -> dict:
config['account'][0]['carrot-pull'] = True
else:
config['account'][0]['carrot-pull'] = False
if legacy_config.get('BROWSE_SPECIALPAGE') and legacy_config.get('BROWSE_SPECIALPAGE').upper() in ('Y', 'YES'):
config['account'][0]['browse-specialpage'] = True
else:
config['account'][0]['browse-specialpage'] = False
if legacy_config.get('LOG_SAVE') and legacy_config.get('LOG_SAVE').upper() in ('Y', 'YES'):
config['logging'] = True
else:
@ -111,6 +115,8 @@ def check_config(config: dict) -> bool:
return False
if not isinstance(i.get('carrot-pull'), bool):
return False
if not isinstance(i.get('browse-specialpage'), bool):
return False
else:
return False
if not isinstance(config.get('logging'), bool):