logger.warning('YOU DO NOT SPECIFY `--download` OPTION !!!')
if args.id:
- _ = map(lambda id: id.strip(), args.id.split(','))
+ _ = map(lambda id_: id_.strip(), args.id.split(','))
args.id = set(map(int, filter(lambda id_: id_.isdigit(), _)))
if args.file:
count = html.find('span', attrs={'class': 'count'})
if not count:
logger.error("Can't get your number of favorited doujins. Did the login failed?")
- return
+ return []
count = int(count.text.strip('(').strip(')').replace(',', ''))
if count == 0:
def _callback(request, result):
ret.append(result)
- thread_pool = threadpool.ThreadPool(5)
+ # TODO: reduce threads number ...
+ thread_pool = threadpool.ThreadPool(3)
for page in range(1, pages + 1):
try:
url = '{0}/{1}/'.format(constant.DETAIL_URL, id_)
try:
- response = request('get', url).content
+ response = request('get', url)
+ if response.status_code in (200, ):
+ response = response.content
+ else:
+ logger.debug('Slow down and retry ({}) ...'.format(id_))
+ time.sleep(1)
+ return doujinshi_parser(str(id_))
+
except Exception as e:
logger.critical(str(e))
raise SystemExit
if __name__ == '__main__':
print(doujinshi_parser("32271"))
+ eval
\ No newline at end of file