Doujinshi downloader ็ป ๅฃซๆผซ็ปไธ่ฝฝ
https://github.com/fffonion/xeHentai.git
๏ปฟ# E-Hentai Dลjinshi Downloader
Windows users can download packed binaries from here or here. The package is built using PyInstaller.
Or run directly from source code:
pip install -U requests[socks]
git clone https://github.com/fffonion/xeHentai.git
cd xeHentai
python ./setup.py install
xeH
The program is running in non-interactive mode by default. To run interactively, use xeH.py -i.
If you are running from source code, please copy xeHentai/config.py to your current directory first. Use that file as your config file.
The priority of configuration is: Interactive inputs > Command line options > User config.py > Internal config.py.
Configuration keys๏ผ
False.False.False, English or Romaji title will be used. Default to True.False, image will be named in sequence numbers. Default to False.False.True.False.localhost.none (not serving).None.True.False.1.5.10s.10 KB/s.check for check only and download for download; off to turn off. Default to download.eh.log.2.h.json. Default to False.Usage: xeh [-u USERNAME] [-k KEY] [-c COOKIE] [-i] [--daemon] [-d DIR] [-o]
[-j BOOL] [-r BOOL] [-p PROXY] [--proxy-image | --proxy-image-only]
[--rpc-interface ADDR] [--rpc-port PORT] [--rpc-secret ...]
[--rpc-open-browser BOOL] [--delete-task-files BOOL] [-a BOOL]
[--download-range a-b,c-d,e] [-t N] [--timeout N]
[--low-speed-threshold N] [-f] [--auto-update {check,download,off}]
[--update-beta-channel BOOL] [-l /path/to/eh.log] [-v] [-h]
[--version]
[url [url ...]]
xeHentai Downloader NG
positional arguments:
url gallery url(s) to download
optional arguments:
-u USERNAME, --username USERNAME
username
-k KEY, --key KEY password
-c COOKIE, --cookie COOKIE
cookie string, will be overriden if given -u and -k
-i, --interactive interactive mode, will be ignored in daemon mode
(default: False)
--daemon daemon mode, can't use with -i (default: False)
-d DIR, --dir DIR set download directory (current:
/Users/fffonion/Dev/Python/xeHentai)
-o, --download-ori download original images, needs to login (current:
True)
-j BOOL, --jpn-title BOOL
use Japanese title, use English/Romaji title if turned
off (default: True)
-r BOOL, --rename-ori BOOL
rename gallery image to original name, use sequence
name if turned off (default: False)
-p PROXY, --proxy PROXY
set download proxies, can be used multiple times,
currenlty supported: socks5/4a, http(s), glype.
Proxies are only used on webpages by default (current:
['socks5h://127.0.0.1:16963'])
--proxy-image use proxies on images and webpages (default: True)
--proxy-image-only only use proxies on images, not webpages (current:
False)
--rpc-interface ADDR bind jsonrpc server to this address (current:
localhost)
--rpc-port PORT bind jsonrpc server to this port (default: 8010)
--rpc-secret ... jsonrpc secret string (default: None)
--rpc-open-browser BOOL
automatically open browser after RPC server starts
(default: True)
--delete-task-files BOOL
delete downloaded files when deleting a task (default:
True)
-a BOOL, --archive BOOL
make an archive (.zip) after download and delete
directory (default: False)
--download-range a-b,c-d,e
specify ranges of images to be downloaded, in format
start-end, or single index, use comma to concat
multiple ranges, e.g.: 5-10,15,20-25, default to
download all images
-t N, --thread N download threads count (default: 5)
--timeout N set image download timeout (default: 10s)
--low-speed-threshold N
retry download if speed is lower than specified value
(default: 10 KB/s)
-f, --force download regardless of quota exceeded warning
(default: False)
--auto-update {check,download,off}
check or download update automatically
(default: download)
--update-beta-channel BOOL
check update upon beta channel
(default: True)
-l /path/to/eh.log, --logpath /path/to/eh.log
define log path (default: eh.log)
-v, --verbose show more detailed log (default: 3)
-h, --help show this help message and exit
--version show program's version number and exit
If options are not defined, values from config.py will be used.
If rpc_interface and rpc_port are set, xeHentai will start a RPC server. The request and response follows the JSON-RPC 2.0 standard.
$ curl localhost:8010/jsonrpc -d '{"jsonrpc": "2.0", "id": 1, "method":"xeH.addTask", "params":[[args],{kwargs}]}'
{"jsonrpc": "2.0", "id": 1, "result": "36df423e"}
rpc_secret is a secret key to your RPC server. If it's set, client should include this value in the request. For example when rpc_secret is set to hentai:
$ curl localhost:8010/jsonrpc -d '{"jsonrpc": "2.0", "id": 1, "method":"xeH.addTask", "params":["token:hentai",[args],{kwargs}]}'
{"jsonrpc": "2.0", "id": 1, "result": "36df423e"}
The method filed should start with xeH. and should be a public class method of xeHentai from core.py. And change the name from lowercasewith_underscores notation to lowerCamelCase notation. For example, add_task becomes addTask.
Refer to xeHentai class from core.py for parameters list.
If your browser has a Userscript plugin, you can use xeHentaiHelper.user.js to create tasks directly on e-hentai website. Chrome user will need to install Tampermonkey, for firefox Greasemonkey, and ViolentMonkey for Opera and Maxthon users.
Because e-hentai has enabled https, Chrome user will needs to click on the shield icon in the far right of the address bar and click "Load anyway" or "Load unsafe scripts"
If xeHentai is ran from command line interface or interative mode, the program will exit after it finishes the tasks in h.json (if exists) and given URL.
If there's no URL given from command line, the program will exit after it finishes the tasks in h.json(if exists).
If program is running on daemon mode (-d is set or daemon is set to True), the program will keep running in background.
xeHentai supports three types of proxies:
socks5h://127.0.0.1:1080. If you want to resolve DNS on client side, use socks5://127.0.0.1:1080.http://127.0.0.1:8080.http://example.com/browse.php?u=a&b=4. Please set value of b accordingly. glype is a widely used PHP proxy script. When using, uncheck Encrypt URL, Remove Scripts and check Allow Cookies and open a random URL. The paste the address into configuration.['socks5h://127.0.0.1:1080', 'http://127.0.0.1:8080'].
By default proxies are used to download images and scan webpages. If you don't want to use proxy on downloading images, set proxy_image to False.
glype users are encouraged to set proxy_image to Falseใ
If you only want to use proxy to download image, set proxy_image_only to True in config.py or use the --proxy-image-only CLI option. If both proxy_image and proxy_image_only are set to True, proxy_image will be ignored.
Download ranges are set in format start_positoin-end_positoin. For example, 5-10 means number download first 5 to 10 images, including 5 and 10. Or use 15 to download number 15 only.
Multiple ranges can be seperated with comma. For example,5-10,15.
If no range is given, xeHentai will download all images.
Downloading images will be count towards image limit. This is calculated regarding the popularity of gallery, the server load and/or Hentai@Home bandwidth by e-hentai server.
GPLv3
Blog