• Stars
    star
    724
  • Rank 62,142 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Doujinshi downloader 绅士漫画下载

E-Hentai Dōjinshi Downloader

Build Status

简体中文 繁體中文

xeHentai WebUI

TL;DR

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.

For pros

Configuration file

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:

  • daemon Set to run in default mode, can only use on posix-compatible systems. Refer to Running Modes. Default to False.

  • dir Download directory. Default to current directory.

  • download_ori Set to download original images or not. Default to False.

  • jpn_title Set to select Japanese title or not. If set to False, English or Romaji title will be used. Default to True.

  • rename_ori Set to rename images to their orginal names. If set to False, image will be named in sequence numbers. Default to False.

  • make_archive Set to make a ZIP archive after download and delete downloaded directory. Default to False.

  • proxy Proxy list. Refer to Proxies.

  • proxy_image Set to use proxy both on downloading images and scanning webpages. Default to True.

  • proxy_image_only Set to use proxy only on downloading images. Default to False.

  • rpc_interface RPC server binding IP. Refer to JSON-RPC. Default to localhost.

  • rpc_port RPC server binding port. Default to none (not serving).

  • rpc_secret RPC secret key. Default to None.

  • rpc_open_browser automatically open browser after RPC server starts. Default to True.

  • delete_task_files Set to delete downloaded files when deleting a task. Default to False.

  • download_range Set image download range. Refer to Download range. Default to download all images.

  • scan_thread_cnt Thread count for scanning webpages. Default to 1.

  • download_thread_cnt Thread count for downloading images. Default to 5.

  • download_timeout Timeout of download images. Default to 10s.

  • low_speed_threshold Retry download if speed is lower than specified value. Default to 10 KB/s.

  • ignored_errors Set the error codes to ignore and continue downloading. Default to empty. Error codes can be obtained from const.py.

  • auto_update turn on auto update of program check for check only and download for download; off to turn off. Default to download.

  • update_beta_channel set to true to update to dev branch

  • log_path Set log file path. Default to eh.log.

  • log_verbose Set log level with integer from 1 to 3. Bigger value means more verbose output. Default to 2.

  • save_tasks Set to save uncompleted tasks in h.json. Default to False.

Command line options

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.

JSON-RPC

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 lower_case_with_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"

Running modes

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.

Proxies

xeHentai supports three types of proxies:

  • socks proxy: socks5h://127.0.0.1:1080. If you want to resolve DNS on client side, use socks5://127.0.0.1:1080.
  • http(s) proxy: http://127.0.0.1:8080.
  • glype proxy: 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.

Multiple proxies can be specified at the same time. The format can be like : ['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 range

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.

Misc

Image limit

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.

License

GPLv3


Blog  Blog

More Repositories

1

Xunlei-Fastdick

迅雷快鸟 Xunlei Network Accelerator For Router
Python
819
star
2

lua-resty-acme

Automatic Let's Encrypt certificate serving and Lua implementation of ACMEv2 procotol
Lua
159
star
3

lua-resty-openssl

FFI-based OpenSSL binding for OpenResty
Lua
130
star
4

tplink-plug-exporter

TP-Link Smart Plug Prometheus Exporter
Go
122
star
5

lua-resty-sniproxy

SNI Proxy based on stream-lua-nginx-module
Lua
83
star
6

cloudflare-partner-cli

Set CNAME to use Cloudflare using the partner program
Python
73
star
7

lua-resty-multiplexer

Transparent port service multiplexer for stream subsystem
Lua
60
star
8

JJGet

啊,首先,你得有一个晋江课金账号
C#
48
star
9

xeHentai-webui

The web interface for xeHentai https://github.com/fffonion/xeHentai
Vue
32
star
10

MAClient

拡散性ミリオンアーサー Python Client【作死系列
Python
28
star
11

lua-resty-shdict-server

Use ngx.shared as a Redis server
Lua
15
star
12

lua-resty-danmaku

Live danmaku server in OpenResty (WIP)
Lua
12
star
13

GeoIPASNum-Generator

Generate MaxMind format GeoIPASNum.dat from bgp.he.net
Python
11
star
14

ljpack

[WIP] LuaJIT string.buffer serializer/deserializer in golang
Go
9
star
15

httplib2-exp

Some httplib2 scripts; using modified httplib2->https://github.com/fffonion/httplib2-plus
Python
7
star
16

ESP32-e-Paper-DHT22-Display

读取温湿度,并显示在墨水屏上。 基于 TTGO T5-display 和 DHT22。
C++
5
star
17

RoameBot

路游动漫壁纸下载器
Python
4
star
18

kvm-github-actions-runner

Shell
4
star
19

xeHentaiHelper.user.js

The Userscript for xeHentai RPC
JavaScript
4
star
20

JiDan-GuanBing

华科南三门开源鸡蛋灌饼
3
star
21

wcat-makedie

jp.colopl.wcat/白猫プロジェクト makedie toolkit
C#
3
star
22

httplib2-plus

More reasonable httplib2; add chunk read support and fix proxy bugs; forked from httplib2-0.8
Python
3
star
23

mi-vacuum-exporter

Export Mi Home vacuum robot metrics to grafana dashboard
Go
3
star
24

gnuk-64k

GnuK fork that runs on 64KB flash. https://wiki.debian.org/GNUK
C
3
star
25

meta-hisilicon

Openembedded layer for hisilicon hi3716cv200. (krogoth)
PHP
2
star
26

npa-python

Extraction Utility for Nitroplus N2System-based games (reimplementation of https://github.com/Wilhansen/nipa)
Python
2
star
27

lua-resty-openssl-aux-module

C FFI module to interact with SSL operations in OpenResty
C
2
star
28

SleepEarly

Android应用:我不要熬夜了
Java
2
star
29

WeiboImageBed

微博图床一键上传
Python
1
star
30

docker-compile-system

Simplify the process of building Debian package.
Shell
1
star