🔨 添加【沃邮箱俱乐部】签到

This commit is contained in:
Sitoi 2021-05-06 14:16:58 +08:00
parent e565e6f315
commit 4b82dd39dd

View File

@ -88,12 +88,64 @@ class WoMailCheckIn:
msg += "沃邮箱执行任务错误错误"
return msg
@staticmethod
def dotask2(womail_url):
msg = ""
userdata = re.findall("mobile.*", womail_url)[0]
url = "https://club.mail.wo.cn/clubwebservice/?" + userdata
headers = {
"User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400"
}
try:
res = requests.get(url=url, headers=headers, allow_redirects=False)
set_cookie = res.headers["Set-Cookie"]
cookies = re.findall("SESSION.*?;", set_cookie)[0]
if "SESSION" in cookies:
headers = {
"User-Agent": "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3868.400 QQBrowser/10.8.4394.400",
"Cookie": cookies,
}
# 获取用户信息
try:
url = "https://club.mail.wo.cn/clubwebservice/club-user/user-info/get-user-score-info/"
res = requests.get(url=url, headers=headers)
result = res.json()
integralTotal = result.get("integralTotal")
userMobile = result.get("userPhoneNum")
userdata = f"帐号信息: {userMobile[:3]}****{userMobile[-4:]}\n当前积分:{integralTotal}\n"
msg += userdata
url_params = {
"每日签到": "https://club.mail.wo.cn/clubwebservice/growth/userSign",
"参与活动": f"https://club.mail.wo.cn/clubwebservice/growth/addIntegral?phoneNum={userMobile}&resourceType=huodong",
"沃邮箱邮件查看": f"https://club.mail.wo.cn/clubwebservice/growth/addIntegral?phoneNum={userMobile}&resourceType=lookMail",
"沃门户": f"https://club.mail.wo.cn/clubwebservice/growth/addIntegral?phoneNum={userMobile}&resourceType=womenhuzhuye",
}
# 执行任务
for key, data in dict.items(url_params):
try:
res = requests.get(url=data, headers=headers).json()
result = res.get("description")
msg += f"{key}: {result}\n"
except Exception as e:
print(f"沃邮箱俱乐部执行任务【{key}】错误", e)
msg += f"沃邮箱俱乐部执行任务【{key}】错误"
except Exception as e:
print("沃邮箱俱乐部获取用户信息失败", e)
msg += "沃邮箱俱乐部获取用户信息失败\n"
else:
msg += "沃邮箱俱乐部获取用户信息失败\n"
except Exception as e:
print("沃邮箱俱乐部获取cookies失败", e)
msg += "沃邮箱俱乐部获取cookies失败\n"
return msg
def main(self):
womail_url = self.check_item.get("womail_url")
try:
cookies = self.login(womail_url)
if cookies:
msg = self.dotask(cookies)
msg += f"\n沃邮箱俱乐部\n{self.dotask2(womail_url)}"
else:
msg = "登录失败"
except Exception as e:
@ -107,5 +159,5 @@ if __name__ == "__main__":
os.path.join(os.path.dirname(os.path.dirname(__file__)), "config/config.json"), "r", encoding="utf-8"
) as f:
datas = json.loads(f.read())
_check_item = datas.get("WOMAIL_URL_LIST", [])[1]
_check_item = datas.get("WOMAIL_URL_LIST", [])[0]
print(WoMailCheckIn(check_item=_check_item).main())