Skip to content

Commit

Permalink
v2.9.2 规避旧的卡池图片丢失导致的异常, close #74
Browse files Browse the repository at this point in the history
  • Loading branch information
azmiao committed Aug 31, 2024
1 parent fb712d4 commit 14ac256
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

#### 马娘别称存在插件目录/uma_info/replace_dict.json文件中,有新增的别称可以提交PR共享出来哦

#### 如果想快速从零开始搭建一个这样的机器人,可以看我的教程哦:[让我栞栞](https://www.594594.xyz/2022/03/05/uma_bot/)
#### 本插件作者已经弃坑马娘,新功能不再增加,仅做重构优化和BUG修复

[![image](https://img.shields.io/badge/license-GPL3.0-blue.svg)](https://raw.githubusercontent.com/azmiao/uma_plugin/main/LICENSE)
[![image](https://img.shields.io/badge/release-2.9.1-orange.svg)](https://github.com/azmiao/uma_plugin)
[![image](https://img.shields.io/badge/release-2.9.2-orange.svg)](https://github.com/azmiao/uma_plugin)
[![image](https://img.shields.io/badge/auther-AZMIAO-blue.svg)](https://github.com/azmiao/uma_plugin)

</div>
Expand Down Expand Up @@ -94,6 +94,7 @@ https://github.com/azmiao/uma_plugin/

| 更新时间 | 版本号 | 更新日志&备注 |
|:--------:|:-------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 24-08-31 | v2.9.2 | 规避旧的卡池图片丢失导致的异常,[issue 74](https://github.com/azmiao/uma_plugin/issues/74) |
| 24-04-18 | v2.9.1 | 马娘抽卡功能新增支持自选育成目标,[issue 72](https://github.com/azmiao/uma_plugin/issues/72) |
| 24-04-18 | v2.9.0 | 适配最新的V2数据库,适配新版官网数据,优化代码,[issue 69](https://github.com/azmiao/uma_plugin/issues/69) |
| 24-02-20 | v2.8.7 | 修复特殊卡池导致的更新卡池错误,[issue 67](https://github.com/azmiao/uma_plugin/issues/67) |
Expand Down
18 changes: 10 additions & 8 deletions uma_gacha_v2/uma_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,22 @@ async def get_pool_data():
# 马娘
uma_title, uma_title_id, uma_title_img, uma_up_list = '', '', '', []
if pool[0]:
uma_title = pool[0].find('div', {"class": "floatnone"}).find('a').get('title')
uma_title_id = pool[0].find('div', {"class": "floatnone"}).find('img').get('alt').replace(' ', '_')
uma_title_img = pool[0].find('div', {"class": "floatnone"}).find('img').get('src').replace('thumb/', '') \
.replace('/400px-' + uma_title_id, '')
pool_find = pool[0].find('div', {"class": "floatnone"})
uma_title = pool_find.find('a').get('title') if pool_find.find('a') else None
uma_title_id = pool_find.find('img').get('alt').replace(' ', '_') if pool_find.find('img') else None
uma_title_img = pool_find.find('img').get('src').replace('thumb/', '') \
.replace('/400px-' + uma_title_id, '') if pool_find.find('img') else None
uma_up_list = [span.find('a').get('title') for span in
pool[0].find_all('span', {"style": "display: table-cell;"})]
uma_up = {'3': uma_up_list, '2': [], '1': []}
# 支援卡
chart_title, chart_title_id, chart_title_img, chart_up_list, chart_up_img_list = '', '', '', [], []
if pool[1]:
chart_title = pool[1].find('div', {"class": "floatnone"}).find('a').get('title')
chart_title_id = pool[1].find('div', {"class": "floatnone"}).find('img').get('alt').replace(' ', '_')
chart_title_img = pool[1].find('div', {"class": "floatnone"}).find('img').get('src').replace('thumb/', '') \
.replace('/400px-' + chart_title_id, '')
pool_find = pool[1].find('div', {"class": "floatnone"})
chart_title = pool_find.find('a').get('title') if pool_find.find('a') else None
chart_title_id = pool_find.find('img').get('alt').replace(' ', '_') if pool_find.find('img') else None
chart_title_img = pool_find.find('img').get('src').replace('thumb/', '') \
.replace('/400px-' + chart_title_id, '') if pool_find.find('img') else None
chart_up_list = [span.find('a').get('title') for span in
pool[1].find_all('span', {"style": "display:inline-block;"})]
chart_up_img_list = [span.find('img').get('alt') for span in
Expand Down
4 changes: 2 additions & 2 deletions uma_gacha_v2/update_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def update():
await delete_old_folder()
logger.info('====马娘抽卡信息更新完成====')
except Exception as e:
logger.info(f'马娘卡池信息初始化失败:{e}')
logger.error(f'马娘卡池信息初始化失败:{e}')


# 自动更新
Expand All @@ -54,7 +54,7 @@ async def auto_update():
logger.info('====马娘抽卡信息更新完成====')
return '马娘抽卡信息更新完成'
except Exception as e:
logger.info(f'马娘卡池信息更新失败:{e}')
logger.error(f'马娘卡池信息更新失败:{e}')
return f'马娘卡池信息更新失败:{e}'


Expand Down

0 comments on commit 14ac256

Please sign in to comment.