Skip to content

Commit 9c2fb65

Browse files
committed
修复了一个BUG
修复了 磁力搜索 因为没有记录而报错的BUG
1 parent fdee193 commit 9c2fb65

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

xunbot/plugins/bt/data_source.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ async def get_bt_info(url: str) -> str:
2323
html_data = requests.get(url, headers=header)
2424
html = etree.HTML(html_data.text)
2525

26+
num = html.xpath('//div[@id="wall"]//span/b/text()')[0]
27+
if num == '0':
28+
return "没有找到记录"
29+
2630
div_all = html.xpath('//div[@class="search-item"]')
2731
div_all = div_all[:MAXINFO_BT] if len(div_all) > MAXINFO_BT else div_all
2832
line_list = [await get_item_line(div) for div in div_all]

0 commit comments

Comments
 (0)