]> git.lizzy.rs Git - nhentai.git/commitdiff
update usages
authorRicter Z <ricterzheng@gmail.com>
Mon, 17 Oct 2016 13:43:40 +0000 (21:43 +0800)
committerRicter Z <ricterzheng@gmail.com>
Mon, 17 Oct 2016 13:43:40 +0000 (21:43 +0800)
.travis.yml
README.md
images/download.png
images/search.png
nhentai/command.py
nhentai/constant.py
nhentai/doujinshi.py

index f7b1f0d3b4d9bd2b9d3572bdddac2c10d1142b0a..99fba6365407ff00fc78117a45f4fab0ee89ea0f 100644 (file)
@@ -1,6 +1,5 @@
 os:
     - linux
-    - os x
 
 language: python
 python:
@@ -14,5 +13,5 @@ install:
     - python setup.py install
 
 script:
-    - NHENTAI=nhentai.net nhentai --search umaru
-    - NHENTAI=nhentai.net nhentai --ids=152503,146134 -t 10 --download --path=/tmp/
+    - NHENTAI=https://nhentai.net nhentai --search umaru
+    - NHENTAI=https://nhentai.net nhentai --id=152503,146134 -t 10 --path=/tmp/
index 8d6ded036884b48193b02e61d3ead181a21601ff..78c22a31a6ab8bcc183f8659e82207c12a7b10f5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -18,16 +18,10 @@ nhentai
     
 
 ### 用法
-+ 下载指定 id 的本子:
-
-
-    nhentai --id=123855
-
-
 + 下载指定 id 列表的本子:
 
 
-    nhentai --ids=123855,123866
+    nhentai --id=123855,123866
     
 
 + 下载某关键词第一页的本子(不推荐):
@@ -36,10 +30,17 @@ nhentai
     nhentai --search="tomori" --page=1 --download
 
 
-`-t, --thread` 指定下载的线程数,最多为 10 线程。  
-`--path` 指定下载文件的输出路径,默认为当前目录。  
-`--timeout` 指定下载图片的超时时间,默认为 30 秒。  
-`--proxy` 指定下载的代理,例如: http://127.0.0.1:8080/
+`-t, --thread`:指定下载的线程数,最多为 10 线程。  
+`--path`:指定下载文件的输出路径,默认为当前目录。  
+`--timeout`:指定下载图片的超时时间,默认为 30 秒。  
+`--proxy`:指定下载的代理,例如: http://127.0.0.1:8080/
+
+### 自建 nhentai 镜像
+如果想用自建镜像下载 nhentai 的本子,需要搭建 nhentai.net 和 i.nhentai.net 的反向代理。  
+例如用 h.loli.club 来做反向代理的话,需要 h.loli.club 反代 nhentai.net,i.h.loli.club 反带 i.nhentai.net。  
+然后利用环境变量来下载:  
+
+    NHENTAI=http://h.loli.club nhentai --id 123456
 
 
 ![](./images/search.png)  
index 8b2e93dd251184aab0223acb2034c3ca2c3c6c30..6c3767c64a7ec3724f063ccbad5629d75bdadf5c 100644 (file)
Binary files a/images/download.png and b/images/download.png differ
index 1d36dcb9b91a01ca411d567d860d229f5c1aca0c..70bfeaf878e1967d3895cefee44e9b6d1530aa0d 100644 (file)
Binary files a/images/search.png and b/images/search.png differ
index 73d2e1461c204a267d1c4b3658790f5c965dccf4..a0cac082797ededdade39ace8dece6d430b300c9 100644 (file)
@@ -7,10 +7,12 @@ from nhentai.parser import doujinshi_parser, search_parser, print_doujinshi
 from nhentai.doujinshi import Doujinshi
 from nhentai.downloader import Downloader
 from nhentai.logger import logger
+from nhentai.constant import BASE_URL
 
 
 def main():
     banner()
+    logger.info('Using mirror: {0}'.format(BASE_URL))
     options = cmd_parser()
 
     doujinshi_ids = []
index 0dab75a10e7f4580327587c3f3835d8ee9875908..1c7eca498e8c3e76a77acbbffa98de1dc17fb993 100644 (file)
@@ -1,9 +1,12 @@
 import os
+import urlparse
 
 BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
 
 DETAIL_URL = '%s/g' % BASE_URL
 SEARCH_URL = '%s/search/' % BASE_URL
-IMAGE_URL = 'https://i.%s/galleries' % BASE_URL
+
+u = urlparse.urlparse(BASE_URL)
+IMAGE_URL = '%s://i.%s/galleries' % (u.scheme, u.hostname)
 
 PROXY = {}
index 1e557f255ee98b6c636db12b6cad9f60a665fd6e..e6640528bdf746ba2724280ea8f5bc0193b9bb5d 100644 (file)
@@ -1,7 +1,7 @@
 # coding: utf-8
 from __future__ import print_function
 from tabulate import tabulate
-from builtins import range
+from builtins import range
 
 from nhentai.constant import DETAIL_URL, IMAGE_URL
 from nhentai.logger import logger