From 9ca48dfaf34a2b40e81515b33cd218ed76818fcd Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 21 Apr 2024 20:41:59 +0800 Subject: [PATCH] :bug: Fix some parsed expire date --- models/honkai.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/models/honkai.py b/models/honkai.py index ede94ec..f53a432 100644 --- a/models/honkai.py +++ b/models/honkai.py @@ -30,6 +30,11 @@ reward_map = { "Flaming Potent Tea": "烈焰浓茶", "Steamed Puffergoat Milk": "热浮羊奶", "Bottled Soda": "罐装快乐水", + "All or Nothing": "孤注一掷", + "“Sour Dreams” Soft Candy": "「酸梦」牌软糖", + "High-Tech Protective Gear": "科技护具", + "Sweet Dreams Soda": "好梦气泡饮", + "“Dreamlight” Mixed Sweets": "「彩梦」什锦糖果", } @@ -60,7 +65,7 @@ def parse_code(tr: Tag) -> Code: _, expire = datetime(1970, 1, 1, 1, 0, 0, 0), datetime(2099, 12, 31, 23, 59, 59, 999999) if isinstance(expire, str): try: - expire = expire.split(": ")[1].replace("", "") + expire = expire.split(": ")[1].replace("", "").replace("", "") if "Unknown" in expire: expire = datetime(2099, 12, 31, 23, 59, 59, 999999) elif "Expired" in expire: @@ -72,8 +77,8 @@ def parse_code(tr: Tag) -> Code: expire = expire.replace(year=datetime.now().year) except IndexError: expire = datetime(2099, 12, 31, 23, 59, 59, 999999) - expire = timezone("Asia/Shanghai").localize(expire) - expire = int(expire.timestamp() * 1000) + expire = timezone("Asia/Shanghai").localize(expire) + expire = int(expire.timestamp() * 1000) rewards = [] for reward in str(tds[1]).split("
"): reward_soup = BeautifulSoup(reward, "lxml")