diff --git a/hust-lib/README.md b/hust-lib/README.md index 0779187..12621f5 100644 --- a/hust-lib/README.md +++ b/hust-lib/README.md @@ -19,4 +19,4 @@ Key Binding | Description Ctrl + ENTER | 跳转 ### LICENSE -Copyright (c) 2019 Lewis Tian. Licensed under the MIT license. \ No newline at end of file +Copyright (c) 2019 Lewis Tian. Licensed under the GNU General Public License v3.0. \ No newline at end of file diff --git a/hust-lib/src/library.ico b/hust-lib/src/library.ico new file mode 100644 index 0000000..775b57b Binary files /dev/null and b/hust-lib/src/library.ico differ diff --git a/hust-lib/src/main.py b/hust-lib/src/main.py index eb29af0..03641d0 100644 --- a/hust-lib/src/main.py +++ b/hust-lib/src/main.py @@ -176,8 +176,11 @@ def books(self): soup = Soup(r.text, 'html5lib') table = soup.find('table', {'calss', 'browseScreen'}) pages = table.find('tr', {'class', 'browsePager'}) - except Exception as e: - self.error.emit(e) + except: + self.error.emit('未找到该书的信息...') + return + if not pages: + QDesktopServices.openUrl(QUrl(f'http://ftp.lib.hust.edu.cn/search*chx/X?SEARCH={self.kw}')) return last_page = pages.find_all('a')[-2] link = last_page['href'] @@ -193,8 +196,8 @@ def detail(self, link): r = requests.get(url, headers = self.headers) soup = Soup(r.text, 'html5lib') info = soup.find_all('tr', {'calss', 'bibItemsEntry'}) - except Exception as e: - self.error.emit(e) + except: + self.error.emit('未找到该书的信息...') return ret = '\n'.join([x.text.replace('\n', '') for x in info]) self.detail_done.emit(ret)