Package: xeHentai
E-Hentai Dōjinshi Downloader简体中文繁體中文xeHentai WebUITL;DRWindows users can download packed binaries fromhereorhere. The package is built usingPyInstaller.Or run directly from source code:pipinstall-Urequests[socks]gitclonehttps://github.com/fffonion/xeHentai.gitcdxeHentai
python./setup.pyinstall
xeHThe program is running in non-interactive mode by default. To run interactively, usexeH.py -i.For prosConfiguration fileIf you are running from source code, please copyxeHentai/config.pyto 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：daemonSet to run in default mode, can only use on posix-compatible systems. Refer toRunning Modes. Default toFalse.dirDownload directory. Default to current directory.download_oriSet to download original images or not. Default toFalse.jpn_titleSet to select Japanese title or not. If set toFalse, English or Romaji title will be used. Default toTrue.rename_oriSet to rename images to their orginal names. If set toFalse, image will be named in sequence numbers. Default toFalse.proxyProxy list. Refer toProxies.proxy_imageSet to use proxy both on downloading images and scanning webpages. Default toTrue.proxy_image_onlySet to use proxy only on downloading images. Default toFalse.rpc_interfaceRPC server binding IP. Refer toJSON-RPC. Default tolocalhost.rpc_portRPC server binding port. Default tonone(not serving).rpc_secretRPC secret key. Default toNone.delete_task_filesSet to delete downloaded files when deleting a task. Default toFalse.make_archiveSet to make a ZIP archive after download and delete downloaded directory. Default toFalse.download_rangeSet image download range. Refer toDownload range. Default to download all images.scan_thread_cntThread count for scanning webpages. Default to1.download_thread_cntThread count for downloading images. Default to5.download_timeoutTimeout of download images. Default to10s.ignored_errorsSet the error codes to ignore and continue downloading. Default toempty. Error codes can be obtained fromconst.py.log_pathSet log file path. Default toeh.log.log_verboseSet log level with integer from 1 to 3. Bigger value means more verbose output. Default to2.save_tasksSet to save uncompleted tasks inh.json. Default toFalse.Command line optionsUsage: 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 ...]
           [--delete-task-files BOOL] [-a BOOL] [--download-range a-b,c-d,e]
           [-t N] [--timeout N] [-f] [-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)
  --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)
  -f, --force           download regardless of quota exceeded warning
                        (default: False)
  -l /path/to/eh.log, --logpath /path/to/eh.log
                        define log path (current:
                        /Users/fffonion/Dev/Python/xeHentai/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 exitIf options are not defined, values fromconfig.pywill be used.JSON-RPCIfrpc_interfaceandrpc_portare set, xeHentai will start a RPC server. The request and response follows theJSON-RPC 2.0standard.$ curl localhost:8010/jsonrpc -d '{"jsonrpc": "2.0", "id": 1, "method":"xeH.addTask", "params":[[args],{kwargs}]}'
{"jsonrpc": "2.0", "id": 1, "result": "36df423e"}rpc_secretis a secret key to your RPC server. If it's set, client should include this value in the request. For example whenrpc_secretis set tohentai:$ 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 withxeH.and should be a public class method ofxeHentaifromcore.py. And change the name fromlower_case_with_underscoresnotation tolowerCamelCasenotation. For example,add_taskbecomesaddTask.Refer toxeHentaiclass fromcore.pyfor parameters list.If your browser has a Userscript plugin, you can usexeHentaiHelper.user.jsto create tasks directly on e-hentai website. Chrome user will need to installTampermonkey, for firefoxGreasemonkey, 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 modesIf xeHentai is ran from command line interface or interative mode, the program will exit after it finishes the tasks inh.json(if exists) and given URL.If there's no URL given from command line, the program will exit after it finishes the tasks inh.json(if exists).If program is running on daemon mode (-dis set ordaemonis set toTrue), the program will keep running in background.ProxiesxeHentai supports three types of proxies:socks proxy:socks5h://127.0.0.1:1080. If you want to resolve DNS on client side, usesocks5://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 ofbaccordingly. glype is a widely used PHP proxy script. When using, uncheckEncrypt URL,Remove Scriptsand checkAllow Cookiesand 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, setproxy_imagetoFalse.glype users are encouraged to setproxy_imagetoFalse。If you only want to use proxy to download image, setproxy_image_onlytoTrueinconfig.pyor use the--proxy-image-onlyCLI option. If bothproxy_imageandproxy_image_onlyare set toTrue,proxy_imagewill be ignored.Download rangeDownload ranges are set in formatstart_positoin-end_positoin. For example,5-10means number download first 5 to 10 images, including 5 and 10. Or use15to 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.MiscImage limitDownloading 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.LicenseGPLv3BlogChangelog2.020增加RPC帮助函数：get_info，get_config，update_config，get_image增加通过RPC看图和下载压缩包功能增加delete_task_files选项，设置是否删除任务时同时删除下载的文件修复Windows文件夹不能以空格结尾以及文件不能以.结尾修复下载时的临时文件在Windows下报错Error 32的问题2.019增加图片地址解析时的错误处理增加使用流模式下载图片，优化判断丧尸线程修复无法从环境变量中获得LOCALE时的问题修复unichr被当成局部变量的问题修复交互模式在Python3中的一个问题2.018增加jpn_title选项，选择是否使用日语标题增加download_range选项，选择下载范围增加timeout选项，设置下载图片的超时增加proxy_image_only选项，设置仅使用代理下载图片命令行增加--force选项，设置忽略配额继续下载; 配置增加ignored_errors选项，设置忽略的错误码检查下载的图片是否完整识别socks5h代理字符串2.017修复匹配网址的正则表达式修复表站自动转换里站逻辑修复下载图片重试后重命名失败的问题修复原始文件名与自动编号冲突时重命名异常的问题2.016修复超出配额的判断修复可能会下到评论中的图的问题修复无法匹配安装在根目录glype的代理问题某些错误现在会显示详细信息增加proxy_image选项，选择是否使用代理下载图片2.015显示重命名时的错误修复扩展名中多余的.修复Windows下文件名的保留字符<,>2.014修复cookie中只有nw判断为已登录的bug登录失败时显示网页上的错误信息交互支持逗号分割多个任务，命令行模式支持同时添加多个任务修复重命名的bug2.013修复页数>=1000页时抽风的bug原始文件名冲突时自动+12.012修复Windows下中文路径的问题2.011修复每页缩略图数量不是40时下载不完整的bug90秒没有新下载图片则自动结束任务本子包含重复图片时直接复制2.010图片404时重试2.009交互模式默认值改为配置中设置的值2.008跳过Content Warning2.007修复本子中有重复图时无法自动退出的bug其他稳定性修复2.006增加make_archive, 下载完成后生成zip压缩包并删除下载目录完善reload机制检测IP是否被ban并自动更换代理IP2.005增加rpc_secreti18n/zh_cn更名为i18n/zh_hans2.004支持Python32.003读取 .ehentai.cookie交互模式不保存任务添加--rename-ori参数和配置如果用户配置有问题，从内置配置读取默认值其他更新2.002支持glype代理类型2.001初始发布