| Total Complexity | 6 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 2 | """ |
||
| 3 | cron: 55 18 * * * |
||
| 4 | new Env('CCAVA'); |
||
| 5 | """ |
||
| 6 | |||
| 7 | import requests |
||
| 8 | |||
| 9 | from notify_mtr import send |
||
| 10 | from utils import get_data |
||
| 11 | |||
| 12 | |||
| 13 | class CCAVA: |
||
| 14 | def __init__(self, check_items): |
||
| 15 | self.check_items = check_items |
||
| 16 | |||
| 17 | @staticmethod |
||
| 18 | def sign(cookie): |
||
| 19 | url = "https://pc.ccava.net/zb_users/plugin/mochu_us/cmd.php?act=qiandao" |
||
| 20 | res = requests.get(url, headers={"Cookie": cookie}).json() |
||
| 21 | if "登录" in res["msg"]: |
||
| 22 | return "cookie 失效" |
||
| 23 | if "今天" in res["msg"]: |
||
| 24 | return f'重复签到,剩余 {res["giod"]} 月光币' |
||
| 25 | return f'签到成功,剩余 {res["giod"]} 月光币' |
||
| 26 | |||
| 27 | def main(self): |
||
| 28 | msg_all = "" |
||
| 29 | for check_item in self.check_items: |
||
| 30 | cookie = check_item.get("cookie") |
||
| 31 | msg = self.sign(cookie) |
||
| 32 | msg_all += msg + "\n\n" |
||
| 33 | return msg_all |
||
| 34 | |||
| 35 | |||
| 36 | if __name__ == "__main__": |
||
| 37 | _data = get_data() |
||
| 38 | _check_items = _data.get("CCAVA", []) |
||
| 39 | result = CCAVA(check_items=_check_items).main() |
||
| 40 | send("CCAVA", result) |
||
| 41 |