From b4d261a483abe48382fabd0dc4e41fc8d309bf07 Mon Sep 17 00:00:00 2001 From: ricterz Date: Sun, 19 Apr 2015 18:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E6=94=B9=E4=BA=86=E4=BB=80?= =?UTF-8?q?=E4=B9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hentai/downloader.py | 4 +++- hentai/parser.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hentai/downloader.py b/hentai/downloader.py index 5b80471..efcee69 100644 --- a/hentai/downloader.py +++ b/hentai/downloader.py @@ -1,6 +1,7 @@ #coding: utf-8 import os import sys +import signal import threading import Queue import requests @@ -82,4 +83,5 @@ class Downloader(object): for thread in self.threads: thread.join() - logger.log(15, u'🍺 All done, saved to \'%s\'!' % folder) \ No newline at end of file + logger.log(15, u'🍺 All done, saved to \'%s\'!' % folder) + diff --git a/hentai/parser.py b/hentai/parser.py index 4ba9565..428c1f1 100644 --- a/hentai/parser.py +++ b/hentai/parser.py @@ -14,7 +14,12 @@ def dojinshi_parser(id): dojinshi['id'] = id url = '%s/%d/' % (DETAIL_URL, id) - response = requests.get(url).content + try: + response = requests.get(url).content + except Exception, e: + logger.critical('%s%s' % tuple(e.message)) + sys.exit() + html = BeautifulSoup(response) dojinshi_info = html.find('div', attrs={'id': 'info'})