From 1d158855d1475f3b8fa6272d98adf03b2a3d146a Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 13 Jan 2024 14:08:18 +0800 Subject: [PATCH] :bug: Fix some parsed reward names --- .github/workflows/add.yml | 3 +- .github/workflows/daily.yml | 3 +- data/code.json | 793 +++++++++++++++++++++++++++++++++++- main.py | 2 + models/honkai.py | 5 +- 5 files changed, 799 insertions(+), 7 deletions(-) diff --git a/.github/workflows/add.yml b/.github/workflows/add.yml index b70a5d9..5796baf 100644 --- a/.github/workflows/add.yml +++ b/.github/workflows/add.yml @@ -61,8 +61,7 @@ jobs: with: author_name: github-actions[bot] author_email: github-actions[bot]@users.noreply.github.com - push: 'origin remote --force' - new_branch: 'remote' + push: 'origin main' message: ':sparkles: Update Codes' add: | 'data' diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index b6daa95..2478643 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -40,8 +40,7 @@ jobs: with: author_name: github-actions[bot] author_email: github-actions[bot]@users.noreply.github.com - push: 'origin remote --force' - new_branch: 'remote' + push: 'origin main' message: ':sparkles: Update Codes' add: | 'data' diff --git a/data/code.json b/data/code.json index ab73b3c..8862caf 100644 --- a/data/code.json +++ b/data/code.json @@ -1,4 +1,793 @@ { - "main": [], - "over": [] + "main": [ + { + "code": "MIYOUSHE2023", + "reward": [ + { + "name": "星琼", + "cnt": 60 + } + ], + "expire": 1689695999999 + }, + { + "code": "9A6BHRKX4XNL", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1685160000999 + }, + { + "code": "5S6BZ93E4WN8", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1685160000999 + }, + { + "code": "TTNAYQ3FMF9U", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1685160000999 + }, + { + "code": "SSNAG9JX5ENU", + "reward": [ + { + "name": "信用点", + "cnt": 5000 + }, + { + "name": "冒险记录", + "cnt": 3 + }, + { + "name": "凝缩以太", + "cnt": 2 + }, + { + "name": "大宇宙炒饭", + "cnt": 3 + } + ], + "expire": 1683475199999 + }, + { + "code": "MB6SZQJX5E6Y", + "reward": [ + { + "name": "星琼", + "cnt": 300 + }, + { + "name": "信用点", + "cnt": 50000 + }, + { + "name": "漫游指南", + "cnt": 5 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1682870399999 + }, + { + "code": "SR8888", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + }, + { + "name": "漫游指南", + "cnt": 3 + }, + { + "name": "提纯以太", + "cnt": 3 + } + ], + "expire": 1682870399999 + } + ], + "over": [ + { + "code": "2AQA294J5R37", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "NB9TKRMK5R23", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "HSRGALAXY23", + "reward": [ + { + "name": "漫游指南", + "cnt": 4 + }, + { + "name": "提纯以太", + "cnt": 3 + }, + { + "name": "安眠锤", + "cnt": 5 + }, + { + "name": "信用点", + "cnt": 20000 + } + ], + "expire": 4102415999999 + }, + { + "code": "US9SND24U8FB", + "reward": [ + { + "name": "干制应急灯", + "cnt": 3 + } + ], + "expire": 4102415999999 + }, + { + "code": "ST9T6DKLVRGX", + "reward": [ + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "4BQSPDKLVQFF", + "reward": [ + { + "name": "迷彩油漆", + "cnt": 3 + } + ], + "expire": 4102415999999 + }, + { + "code": "YTRB6VKMVRZB", + "reward": [ + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "KB9A7VJ5VQW7", + "reward": [ + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "5S9BND25CRBK", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "SOULKGQM2X", + "reward": [ + { + "name": "遗失碎金", + "cnt": 3 + }, + { + "name": "能量饮料", + "cnt": 2 + }, + { + "name": "星芋啵啵", + "cnt": 2 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "ELFNPWQ7ZB", + "reward": [ + { + "name": "遗失碎金", + "cnt": 3 + }, + { + "name": "能量饮料", + "cnt": 2 + }, + { + "name": "星芋啵啵", + "cnt": 2 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "STARRAILGIFT", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "2SP2XE4YBJBB", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "BSN2EWMHA4RP", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "HSRVER10JYTGHC", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 4102415999999 + }, + { + "code": "9TRB7C2LDQBP", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1735228800000 + }, + { + "code": "KBQBEP3L8823", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1731600000000 + }, + { + "code": "PT8TF72MQ93X", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1731600000000 + }, + { + "code": "HoYoFEST CodeShare event to unlock unique code", + "reward": [ + { + "name": "信用点", + "cnt": 20000 + } + ], + "expire": 1703952000000 + }, + { + "code": "VA8APU34C8C3", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1702656000000 + }, + { + "code": "QTRTNC3LU9UX", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1702656000000 + }, + { + "code": "7S9SPCJ5CRUT", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1702656000000 + }, + { + "code": "Prime Gaming", + "reward": [], + "expire": 1699977600000 + }, + { + "code": "STPN3TUUTQ8K", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1696953600000 + }, + { + "code": "TAP8H27JBRGP", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1696003200000 + }, + { + "code": "JSPRZ272S9JB", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1696003200000 + }, + { + "code": "MT79YKNKARJX", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1696003200000 + }, + { + "code": "MB6N2TVCSQ9F", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1695657600000 + }, + { + "code": "8B64E57RPP3P", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1693324800000 + }, + { + "code": "BTN5EL69P6K3", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1693324800000 + }, + { + "code": "LANPVGET8HFT", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1692374400000 + }, + { + "code": "BA7NCHFA9HWX", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1692374400000 + }, + { + "code": "ASN6CHXBRHW3", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1692374400000 + }, + { + "code": "7B6B7GBZTVTB", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1688745600000 + }, + { + "code": "MSPT7HAZTCTX", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1688745600000 + }, + { + "code": "5TPBPGAGBDAK", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1688745600000 + }, + { + "code": "GOODGAME1024", + "reward": [ + { + "name": "凝缩以太", + "cnt": 3 + }, + { + "name": "旅情见闻", + "cnt": 5 + }, + { + "name": "信用点", + "cnt": 10000 + } + ], + "expire": 1687190400000 + }, + { + "code": "SURPRISE1024", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "冒险记录", + "cnt": 3 + }, + { + "name": "疾速粉尘", + "cnt": 2 + }, + { + "name": "信用点", + "cnt": 5000 + } + ], + "expire": 1686067200000 + }, + { + "code": "ZTPTNMTX8LUF", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 50000 + } + ], + "expire": 1685203200000 + }, + { + "code": "8A6T6LBFQ4D3", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1685203200000 + }, + { + "code": "DB7A64BW8LC7", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1685203200000 + }, + { + "code": "CS75WMP976AK", + "reward": [ + { + "name": "星琼", + "cnt": 100 + } + ], + "expire": 1685203200000 + }, + { + "code": "HSRVER10XEDLFE", + "reward": [ + { + "name": "星琼", + "cnt": 50 + }, + { + "name": "信用点", + "cnt": 10000 + }, + { + "name": "漫游指南", + "cnt": 2 + } + ], + "expire": 1683561600000 + }, + { + "code": "2T7BP4JVEBT7", + "reward": [ + { + "name": "信用点", + "cnt": 5000 + }, + { + "name": "冒险记录", + "cnt": 3 + }, + { + "name": "凝缩以太", + "cnt": 2 + }, + { + "name": "大宇宙炒饭", + "cnt": 3 + } + ], + "expire": 1683388800000 + }, + { + "code": "HSRGRANDOPEN1", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "信用点", + "cnt": 5000 + } + ], + "expire": 1682784000000 + }, + { + "code": "HSRGRANDOPEN2", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "漫游指南", + "cnt": 5 + } + ], + "expire": 1682784000000 + }, + { + "code": "HSRGRANDOPEN3", + "reward": [ + { + "name": "星琼", + "cnt": 100 + }, + { + "name": "提纯以太", + "cnt": 4 + } + ], + "expire": 1682784000000 + } + ] } \ No newline at end of file diff --git a/main.py b/main.py index b8e7c74..c31336b 100644 --- a/main.py +++ b/main.py @@ -23,6 +23,8 @@ def merge_code(over: List[Code], custom: CodeList) -> CodeList: def main(): over = get_code() + if not over: + raise ValueError("Get code failed") with open(custom_path, "r", encoding="utf-8") as f: custom = CodeList.model_validate_json(f.read()) custom = merge_code(over, custom) diff --git a/models/honkai.py b/models/honkai.py index fde81a1..05f01a4 100644 --- a/models/honkai.py +++ b/models/honkai.py @@ -24,6 +24,9 @@ reward_map = { "Energy Drink": "能量饮料", "Startaro Bubble": "星芋啵啵", "Lost Gold Fragments": "遗失碎金", + "Hypnotic Hammer": "安眠锤", + "Camo Paint": "迷彩油漆", + "Dry Emergency Light": "干制应急灯", } @@ -69,7 +72,7 @@ def parse_code(tr: Tag) -> Code: rewards = [] for reward in str(tds[1]).split("
"): reward_soup = BeautifulSoup(reward, "lxml") - reward_text = " ".join(reward_soup.text.strip().split()) + reward_text = " ".join(reward_soup.text.strip().split()).replace("×", "x") reward_div = [] if " x " in reward_text: reward_div = reward_text.split(" x ")