get nhentai url from env

This commit is contained in:
Ricter Z 2016-08-11 22:25:10 +08:00
parent 441317c28c
commit 2f756ecb5b
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,9 @@
SCHEMA = 'http://'
import os
SCHEMA = os.getenv('NHENTAI_SCHEMA', 'http://')
# BASE_URL = 'nhentai.net'
BASE_URL = 'nhentai.ricterz.me'
BASE_URL = os.getenv('NHENTAI', 'nhentai.ricterz.me')
URL = '%s%s' % (SCHEMA, BASE_URL)
DETAIL_URL = '%s/g' % URL
SEARCH_URL = '%s/search/' % URL

View File

@ -90,6 +90,9 @@ def search_parser(keyword, page):
title = (title[:85] + '..') if len(title) > 85 else title
id_ = re.search('/g/(\d+)/', doujinshi.a['href']).group(1)
result.append({'id': id_, 'title': title})
if not result:
logger.warn('Not found anything of keyword {}'.format(keyword))
return result