{"id":20842970,"url":"https://github.com/fffonion/xehentai","last_synced_at":"2025-05-16T18:09:20.032Z","repository":{"id":7610960,"uuid":"8969192","full_name":"fffonion/xeHentai","owner":"fffonion","description":"Doujinshi downloader 绅士漫画下载","archived":false,"fork":false,"pushed_at":"2022-03-27T19:36:51.000Z","size":21701,"stargazers_count":724,"open_issues_count":11,"forks_count":86,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-09-17T20:29:33.473Z","etag":null,"topics":["crawler","json-rpc","python","xehentai"],"latest_commit_sha":null,"homepage":"https://yooooo.us/2013/xehentai","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fffonion.png","metadata":{"files":{"readme":"README.chs.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-23T11:18:34.000Z","updated_at":"2024-08-31T02:15:50.000Z","dependencies_parsed_at":"2022-07-31T15:08:54.209Z","dependency_job_id":null,"html_url":"https://github.com/fffonion/xeHentai","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffonion%2FxeHentai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffonion%2FxeHentai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffonion%2FxeHentai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffonion%2FxeHentai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fffonion","download_url":"https://codeload.github.com/fffonion/xeHentai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248600429,"owners_count":21131487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawler","json-rpc","python","xehentai"],"created_at":"2024-11-18T01:26:13.298Z","updated_at":"2025-04-12T16:44:56.022Z","avatar_url":"https://github.com/fffonion.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# 绅♂士♂站♂小♂爬♂虫\n\n[![Build Status](https://travis-ci.org/fffonion/xeHentai.svg?branch=master)](https://travis-ci.org/fffonion/xeHentai)\n\n[English](README.md) [繁體中文](README.cht.md)\n\n[xeHentai Web界面](https://github.com/fffonion/xeHentai-webui)\n\n## 快速入门\n\nwindows用户可以下载可执行文件 [这里](https://github.com/fffonion/xeHentai/releases) [或这里](http://dl.yooooo.us/share/xeHentai/)\n\n或者可以运行源码\n\n```shell\npip install -U requests[socks]\ngit clone https://github.com/fffonion/xeHentai.git\ncd xeHentai\npython ./setup.py install\nxeH\n```\n\n新版本默认为命令行模式，如果需要使用交互模式，请运行`xeH.py -i`\n\n## 详细说明\n\n### 配置文件\n\n使用源码运行的用户请先将`xeHentai/config.py`复制到当前目录。\n\n配置的优先级为 交互模式 \u003e 命令行参数 \u003e 用户config.py \u003e 内置config.py。\n\n常用参数: \n\n - **daemon** 后台模式，仅支持posix兼容的系统，参见[运行模式](#运行模式)，默认为否\n - **dir** 下载目录，默认为当前目录\n - **download_ori** 是否下载原图，默认为否\n - **jpn_title** 是否使用日语标题，如果关闭则使用英文或罗马字标题，默认为是\n - **rename_ori** 将图片重命名为原始名称，如果关闭则使用序号，默认为否\n - **make_archive** 是否下载完成后生成zip压缩包，并删除下载目录，默认为否\n\n高级参数: \n\n - **proxy** 代理列表，参见[代理](#代理)。\n - **proxy_image** 是否同时使用代理来下载图片和扫描网页，默认为是\n - **proxy_image_only** 是否仅使用代理来下载图片，不用于扫描网页，默认为否\n - **rpc_interface** RPC绑定的IP，参见[JSON-RPC](#json-rpc)，默认为`localhost`\n - **rpc_port** RPC绑定的端口，默认为`None`\n - **rpc_secret** RPC密钥，默认为`None` (不开启RPC服务器)\n - **rpc_open_browser** RPC服务端启动后自动打开浏览器页面，默认为是\n - **delete_task_files** 是否删除任务时同时删除下载的文件，默认为否\n - **download_range** 设置下载的图片范围，参见[下载范围](#下载范围)\n - **scan_thread_cnt** 扫描线程数，默认为`1`\n - **download_thread_cnt** 下载线程数，默认为`5`\n - **download_timeout** 设置下载图片的超时，默认为`10`秒\n - **low_speed_threshold** 设置最低下载速度，低于此值将换源重新下载，单位为KB/s，默认为`10`\n - **ignored_errors** 设置忽略的错误码，默认为空，错误码可以从`const.py`中获得\n - **auto_update** 自动检查更新，`check` 仅检查更新，`download` 下载更新，`off` 关闭检查；默认为`download`\n - **update_beta_channel** 设置是否更新到测试版，默认为否\n - **log_path** 日志路径，默认为`eh.log`\n - **log_verbose** 日志等级，可选1-3，值越大输出越详细，默认为`2`\n - **save_tasks** 是否保存任务到`h.json`，可用于断点续传，默认为否\n \n\n### 命令行模式\n```\n用法: xeH [-u USERNAME] [-k KEY] [-c COOKIE] [-i] [--daemon] [-d DIR] [-o]\n           [-j BOOL] [-r BOOL] [-p PROXY] [--proxy-image | --proxy-image-only]\n           [--rpc-interface ADDR] [--rpc-port PORT] [--rpc-secret ...]\n           [--rpc-open-browser BOOL] [--delete-task-files BOOL] [-a BOOL]\n           [--download-range a-b,c-d,e] [-t N] [--timeout N]\n           [--low-speed-threshold N] [-f] [--auto-update {check,download,off}]\n           [--update-beta-channel BOOL] [-l /path/to/eh.log] [-v] [-h]\n           [--version]\n           [url [url ...]]\n\n绅♂士下载器\n\n必选参数:\n  url                   下载页的网址\n\n可选参数:\n  -u USERNAME, --username USERNAME\n                        用户名\n  -k KEY, --key KEY     密码\n  -c COOKIE, --cookie COOKIE\n                        Cookie字符串, 如果指定了用户名和密码, 此项会被忽略\n  -i, --interactive     交互模式, 如果开启后台模式, 此项会被忽略 (默认: False)\n  --daemon              后台模式 (默认: False)\n  -d DIR, --dir DIR     设置下载目录 (默认: 当前目录)\n  -o, --download-ori    是否下载原始图片（如果存在）, 需要登录 (默认: False)\n  -j BOOL, --jpn-title BOOL\n                        使用日语标题, 如果关闭则使用英文或罗马字标题 (默认: True)\n  -r BOOL, --rename-ori BOOL\n                        将图片重命名为原始名称, 如果关闭则使用序号 (默认: False)\n  -p PROXY, --proxy PROXY\n                        设置代理, 可以指定多次, 当前支持的类型: socks5/4a, http(s), glype.\n                        代理默认只用于扫描网页 (默认: 空)\n  --proxy-image         同时使用代理来下载图片和扫描网页（默认: True)\n  --proxy-image-only    仅使用代理来下载图片, 不用于扫描网页 (默认: False)\n  --rpc-interface ADDR  设置JSON-RPC监听IP (默认: localhost)\n  --rpc-port PORT       设置JSON-RPC监听端口 (默认: None)\n  --rpc-secret ...      设置JSON-RPC密钥 (默认: None)\n  --rpc-open-browser BOOL\n                        RPC服务端启动后自动打开浏览器页面 (默认: True)\n  --delete-task-files BOOL\n                        删除任务时同时删除下载的文件 (默认: False)\n  -a BOOL, --archive BOOL\n                        下载完成后生成zip压缩包并删除下载目录 (默认: False)\n  --download-range a-b,c-d,e\n                        设置下载的图片范围, 格式为 开始位置-结束位置, 或者单张图片的位置, 使用逗号来分隔多个范围, 例如\n                        5-10,15,20-25, 默认为下载所有\n  --low-speed-threshold N\n                        设置最低下载速度，低于此值将换源重新下载 (默认: 10 KB/s)\n  -t N, --thread N      下载线程数 (默认: 5)\n  --timeout N           设置下载图片的超时 (默认: 10秒)\n  -f, --force           忽略配额判断, 继续下载 (默认: False)\n  --auto-update {check,download,off}\n                        检查并自动下载更新 (默认: download)\n  --update-beta-channel BOOL\n                        是否更新到测试分支 (默认: True)\n  -l /path/to/eh.log, --logpath /path/to/eh.log\n                        保存日志的路径 (默认: eh.log)\n  -v, --verbose         设置日志装逼等级 (默认: 2)\n  -h, --help            显示本帮助信息\n  --version             显示版本信息\n\n```\n\n如果参数未指定, 则使用config.py中的默认值；否则将覆盖config.py设置的值。\n\n### JSON-RPC\n\n在指定`rpc_interface`和`rpc_port`后, xeHentai会启动RPC服务器。使用[JSON-RPC 2.0](http://www.jsonrpc.org/specification)标准。典型的请求如下：\n\n```\n$ curl localhost:8010/jsonrpc -d '{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\":\"xeH.addTask\", \"params\":[[args],{kwargs}]}'\n{\"jsonrpc\": \"2.0\", \"id\": 1, \"result\": \"36df423e\"}\n```\n\n`rpc_secret`可用于提高安全性。如果`rpc_secret`设置为**hentai**, 则需在params中带上这个值：\n```\n$ curl localhost:8010/jsonrpc -d '{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\":\"xeH.addTask\", \"params\":[\"token:hentai\",[args],{kwargs}]}'\n{\"jsonrpc\": \"2.0\", \"id\": 1, \"result\": \"36df423e\"}\n```\n\n其中`method`为调用的方法，必须以**xeH.** 开头。在[core.py](xeHentai/core.py)的xeHentai类中，所有不以下划线`_`开头的方法均可以通过RPC调用，但需将方法名的下划线命名法改为驼峰命名法。如`add_task`需改为`addTask`。\n\n参数列表请参阅xeHentai类。\n\n如果浏览器安装了用户脚本插件，可以[下载xeHentaiHelper.user.js](http://dl.yooooo.us/userscripts/xeHentaiHelper.user.js)，将会在页面上添加`Add to xeHentai`链接，以支持将当前页面添加到xeHentai中。Chrome用户需要安装[Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)，\nFirefox用户需要安装[Greasemonkey](https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/)，Opera和傲游用户需要安装暴力猴。\n\n**由于绅士站启用了https，而rpc走的是http，所以chrome用户需要点击地址栏右侧盾牌，选择“加载不安全的脚本”**\n\n### 运行模式\n\n如果通过命令行或交互模式指定了下载url，xeHentai会在下载完成`h.json`中存储的任务（如果存在）及指定的url后退出。\n\n如果命令行没有指定url，xeHentai将会在完成存档`h.json`中的队列（如果存在）后继续等待。\n\n如果指定了后台模式（`-d`或设置`daemon`为`True`），xeHentai将会在保持后台运行。\n\n### 代理\n\n目前支持三种模式的代理: \n\n - socks代理，如`socks5h://127.0.0.1:1080`；如果需要在客户端解析DNS，请使用`socks5://127.0.0.1:1080`。\n - http(s)代理，如`http://127.0.0.1:8080`。\n - glype代理，如`http://example.com/browse.php?u=a\u0026b=4`。请根据实际情况修改`b`的名称。glype是目前使用最广的php在线代理，使用时请取消勾选“加密url(Encrypt URL)”、取消勾选“移除脚本 (Remove Scripts)”、勾选“允许cookies (Allow Cookies)”后随意打开一个网页，然后把网址粘贴进来\n\n可以指定多个代理，格式如`['socks5h://127.0.0.1:1080', 'http://127.0.0.1:8080']`。\n\n默认情况下代理会被用于扫描网页和下载图片。如果不需要使用代理下载图片，请在配置文件中设置`proxy_image`为**False**。\n\n如果使用代理仅用于突破封锁的目的，则此项可以设置为`False`；如果需要保证隐私，请将此项设置为`True`。使用glype代理的用户建议将此项设为`False`。\n\n如果仅需要使用代理下载图片，不需要扫描网页，请在配置文件中设置`proxy_image_only`为**True**，或者在运行时加上`--proxy-image-only`参数。如果在配置中的`proxy_image`和`proxy_image_only`均为**True**，则`proxy_image`将被忽略。\n\n### 下载范围\n\n下载范围的格式为使用`开始位置-结束位置`，例如`5-10`表示下载第5到第10张图片，包括第5和第10张；或者单个位置，例如`15`表示下载第15张图片。\n\n可以通过逗号来分割多个范围，例如`5-10,15`表示下载第5到第10张图片以及第15张图片。\n\n如果不输入下载范围，则默认下载所有图片。\n\n\n## 其他说明\n\n### 配额\n\n直接从服务器及镜像途径下载的图片计入配额，从H@H下载的不计算；下载新发布的、冷门的漫画以及原图更有可能消耗配额，下载热门漫画基本不消耗配额\n\n## License\n\nGPLv3\n***\n![@fffonion](http://img.t.sinajs.cn/t5/style/images/register/logo.png)[@fffonion](http://weibo.com/376463435)\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;![Blog](https://s.w.org/about/images/logos/wordpress-logo-32-blue.png)\u0026nbsp;\u0026nbsp;[博客](https://yooooo.us)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffffonion%2Fxehentai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffffonion%2Fxehentai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffffonion%2Fxehentai/lists"}