gallery-dl 是一个命令行程序,用于从多个图像托管站点下载图像库和集合(请参阅)。它是一个跨平台工具,具有许多配置选项和强大的文件命名功能,<Formatting_>
。
Supported Sites
|pypi| |build| |gitter|
..内容::
gallery-dl 的稳定版本分布在 PyPI_ 上,可以使用pip_轻松安装或升级:
..代码:: bash
python3 -m pip install -U gallery-dl
直接从 GitHub 安装最新的开发版本也可以使用 pip_完成:
..代码:: bash
python3 -m pip install -U -I --no-deps --no-cache-dir https://github.com/mikf/gallery-dl/archive/master.tar.gz
注意:Windows 用户应使用 :code: 而不是 :code:。
py -3
python3
建议使用最新版本的pip_,包括基本包 :code: 和 :code:。若要确保这些包是最新的,请运行
setuptools
wheel
..代码:: bash
python3 -m pip install --upgrade pip setuptools wheel
带有Python解释器的预构建可执行文件和随附的必需Python包可用于
Windows <https://github.com/mikf/gallery-dl/releases/download/v1.22.4/gallery-dl.exe>__
Linux <https://github.com/mikf/gallery-dl/releases/download/v1.22.4/gallery-dl.bin>__
|从最新提交构建的可执行文件可以在|https://github.com/mikf/gallery-dl/actions/workflows/executables.yml
使用Snapd_支持的发行版的 Linux 用户可以从 Snap Store 安装 gallery-dl:
..代码:: bash
snap install gallery-dl
安装了Chocolatey_的 Windows 用户可以从 Chocolatey Community Packages 存储库安装 gallery-dl:
..代码:: 电源外壳
choco install gallery-dl
gallery-dl 也可用于 Windows 用户的 Scoop_ “main” 存储桶:
..代码:: 电源外壳
scoop install gallery-dl
要使用 gallery-dl,只需使用你希望从中下载图像的 URL 调用它:
..代码:: bash
gallery-dl [OPTION]... URL...
另请参见 :代码:。
gallery-dl --help
下载图片;在这种情况下,从danbooru通过标签搜索“bonocho”:
..代码:: bash
gallery-dl "https://danbooru.donmai.us/posts?tags=bonocho"
从支持使用用户名和密码进行身份验证的站点获取图像的直接URL:
..代码:: bash
gallery-dl -g -u "<username>" -p "<password>" "https://twitter.com/i/web/status/604341487988576256"
按语言和章节编号筛选漫画章节:
..代码:: bash
gallery-dl --chapter-filter "lang == 'fr' and 10 <= chapter < 20" "https://mangadex.org/title/2354/"
|在远程资源中搜索 URL 并从中下载图像:|(找不到提取器的 URL 将被静默忽略)
..代码:: bash
gallery-dl "r:https://pastebin.com/raw/FLwrCYsT"
如果站点的地址对于其提取程序来说是非标准的,则可以在 URL 前面加上提取程序的名称,以强制使用特定的提取程序:
..代码:: bash
gallery-dl "tumblr:https://sometumblrblog.example"
gallery-dl 的配置文件使用基于 JSON 的文件格式。
|有关选项设置为默认值的(或多或少)完整示例,请参阅库dl.conf_。|有关包含更多涉及的设置和选项的配置文件示例,请参阅 gallery-dl-example.conf_。|所有可用配置选项及其说明的列表可在configuration.rst_中找到。|
gallery-dl 在以下位置搜索配置文件:
视窗: *
%APPDATA%\gallery-dl\config.json*
%USERPROFILE%\gallery-dl\config.json*
%USERPROFILE%\gallery-dl.conf
(``%USERPROFILE%`` usually refers to the user's home directory, i.e. ``C:\Users\<username>\``)
Linux、macOS 等: *
/etc/gallery-dl.conf*
${XDG_CONFIG_HOME}/gallery-dl/config.json*
${HOME}/.config/gallery-dl/config.json*
${HOME}/.gallery-dl.conf
更高配置文件中的值将覆盖以前的配置文件。
命令行选项将覆盖配置文件中的所有相关设置,例如,使用将使用所有设置的默认值写入元数据,覆盖配置文件中的任何特定设置。
--write-metadata
postprocessors.metadata.*
某些提取程序要求你以用户名和密码对的形式提供有效的登录凭据。对于 、、和 .,这是必需的,也是可选的。
nijie
aryion
danbooru
e621
exhentai
idolcomplex
imgbb
inkbunny
mangadex
mangoxo
pillowfort
sankaku
subscribestar
tapas
tsumino
zerochan
你可以在配置文件中设置必要的信息(参见图库dl.conf_)
..代码:: json
{ "extractor": { "twitter": { "username": "<username>", "password": "<password>" } } }
或者你可以直接通过 :code: 和 :code: 或通过 :code: 命令行选项提供它们
-u/--username
-p/--password
-o/--option
..代码:: bash
gallery-dl -u <username> -p <password> URL gallery-dl -o username=<username> -o password=<password> URL
对于由于CAPTCHA或类似原因无法使用用户名和密码登录的网站,或者尚未实现的网站,你可以使用浏览器登录会话中的cookie并将其输入到gallery-dl中。
这可以通过配置文件中的 __ 选项完成,方法是指定
cookies <https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst#extractorcookies>
|Mozilla/Netscape 格式 cookie 的路径.txt浏览器插件导出的文件|(例如 __代表 Chrome,__ 代表 Firefox)
Get cookies.txt <https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid/>
Export Cookies <https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/>
|从浏览器的 Web 开发人员工具收集的名称/值对列表|(在 Firefox <https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector> 中
Chrome <https://developers.google.com/web/tools/chrome-devtools/storage/cookies>)
例如:
..代码:: json
{ "extractor": { "instagram": { "cookies": "$HOME/path/to/cookies.txt" }, "patreon": { "cookies": { "session_id": "K1T57EKu19TR49C51CDjOJoXNQLF7VbdVOiBrC9ye0a" } } } }
你还可以使用 :code: 命令行选项指定 cookie.txt 文件:
--cookies
..代码:: bash
gallery-dl --cookies "$HOME/path/to/cookies.txt" URL
gallery-dl 支持通过 OAuth_对 、 、 、 和实例进行用户身份验证。这通常是可选的,但授予 gallery-dl 代表你的帐户发出请求的能力,并使其能够访问公共用户无法使用的资源。
deviantart
flickr
smugmug
tumblr
mastodon
要将你的帐户链接到 gallery-dl,请首先将其作为参数调用。例如:
oauth:<sitename>
..代码:: bash
gallery-dl oauth:flickr
你将被发送到站点的授权页面,并被要求授予对 gallery-dl 的读取访问权限。授权它,你将看到一个或多个“令牌”,这些令牌应添加到你的配置文件中。
要使用实例进行身份验证,请使用 as 参数运行 gallery-dl。例如:
mastodon
oauth:mastodon:<instance>
..代码:: bash
gallery-dl oauth:mastodon:pawoo.net gallery-dl oauth:mastodon:https://mastodon.social/
.._gallery-dl.conf: https://github.com/mikf/gallery-dl/blob/master/docs/gallery-dl.conf .._gallery-dl-example.conf: https://github.com/mikf/gallery-dl/blob/master/docs/gallery-dl-example.conf .._configuration.rst: https://github.com/mikf/gallery-dl/blob/master/docs/configuration.rst .._Supported 站点: https://github.com/mikf/gallery-dl/blob/master/docs/supportedsites.md .._Formatting: https://github.com/mikf/gallery-dl/blob/master/docs/formatting.md
.._Python: https://www.python.org/downloads/ .._PyPI: https://pypi.org/ .._pip: https://pip.pypa.io/en/stable/ .._Requests: https://requests.readthedocs.io/en/master/ .._FFmpeg: https://www.ffmpeg.org/ .._yt-dlp: https://github.com/yt-dlp/yt-dlp .._youtube-dl: https://ytdl-org.github.io/youtube-dl/ .._PySocks: https://pypi.org/project/PySocks/ .._brotli: https://github.com/google/brotli .._brotlicffi: https://github.com/python-hyper/brotlicffi .._pyOpenSSL: https://pyopenssl.org/ .._Snapd: https://docs.snapcraft.io/installing-snapd .._OAuth: https://en.wikipedia.org/wiki/OAuth .._Chocolatey: https://chocolatey.org/install .._Scoop: https://scoop.sh
..|皮皮|图片:: https://img.shields.io/pypi/v/gallery-dl.svg :目标: https://pypi.org/project/gallery-dl/
..|建造|图片:: https://github.com/mikf/gallery-dl/workflows/tests/badge.svg :目标: https://github.com/mikf/gallery-dl/actions
..|吉特|图片:: https://badges.gitter.im/gallery-dl/main.svg :目标: https://gitter.im/gallery-dl/main