Debian Codegraph @

README.rst

raw
1 ==========
2 gallery-dl
3 ==========
4
5 *gallery-dl* is a command-line program
6 to download image galleries and collections
7 from several image hosting sites
8 (see `Supported Sites <https://codeberg.org/mikf/gallery-dl/src/branch/master/docs/supportedsites.md>`__).
9 It is a cross-platform tool
10 with many
11 `command-line <https://gdl-org.github.io/docs/options.html>`__ and
12 `configuration <https://gdl-org.github.io/docs/configuration.html>`__
13 options, as well as powerful
14 `file-naming capabilities <https://gdl-org.github.io/docs/formatting.html>`__.
15
16
17 |pypi| |discord| |build|
18
19 .. contents::
20
21
22 Dependencies
23 ============
24
25 - Python_ 3.8+
26 - Requests_
27
28 Optional
29 --------
30
31 - yt-dlp_ or youtube-dl_: HLS/DASH video downloads, ``ytdl`` integration
32 - FFmpeg_: Pixiv Ugoira conversion
33 - mkvmerge_: Accurate Ugoira frame timecodes
34 - PySocks_: SOCKS proxy support
35 - brotli_ or brotlicffi_: Brotli compression support
36 - zstandard_: Zstandard compression support
37 - PyYAML_: YAML configuration file support
38 - toml_: TOML configuration file support for Python<3.11
39 - SecretStorage_: GNOME keyring passwords for ``--cookies-from-browser``
40 - Psycopg_: PostgreSQL archive support
41 - truststore_: Native system certificate support
42 - Jinja_: Jinja template support
43
44
45 Installation
46 ============
47
48
49 Pip
50 ---
51
52 The stable releases of *gallery-dl* are distributed on PyPI_ and can be
53 easily installed or upgraded using pip_:
54
55 .. code:: bash
56
57 python -m pip install -U gallery-dl
58
59 Installing the latest dev version directly from ``master``
60 can be done with pip_ as well:
61
62 .. code:: bash
63
64 python -m pip install -U --force-reinstall --no-deps https://codeberg.org/mikf/gallery-dl/archive/master.tar.gz
65
66 Omit :code:`--no-deps` if Requests_ hasn't been installed yet.
67
68 Note: Windows users should use :code:`py` instead of :code:`python`.
69
70 It is advised to use the latest version of pip_,
71 including the essential packages :code:`setuptools` and :code:`wheel`.
72 To ensure these packages are up-to-date, run
73
74 .. code:: bash
75
76 python -m pip install --upgrade pip setuptools wheel
77
78
79 Standalone Executable
80 ---------------------
81
82 Prebuilt executable files with a Python interpreter and
83 required Python packages included are available for
84
85 - `Windows <https://codeberg.org/mikf/gallery-dl/releases/download/v1.32.13/gallery-dl.exe>`__
86 (Requires `Microsoft Visual C++ Redistributable Package (x86) <https://aka.ms/vs/17/release/vc_redist.x86.exe>`__)
87 - `Linux <https://codeberg.org/mikf/gallery-dl/releases/download/v1.32.13/gallery-dl.bin>`__
88
89
90 Nightly Builds
91 --------------
92
93 | Executables built from the latest commit can be found at
94 | https://github.com/gdl-org/builds/releases
95
96
97 Snap
98 ----
99
100 Linux users that are using a distro that is supported by Snapd_ can install *gallery-dl* from the Snap Store:
101
102 .. code:: bash
103
104 snap install gallery-dl
105
106
107 Chocolatey
108 ----------
109
110 Windows users that have Chocolatey_ installed can install *gallery-dl* from the Chocolatey Community Packages repository:
111
112 .. code:: powershell
113
114 choco install gallery-dl
115
116
117 Scoop
118 -----
119
120 *gallery-dl* is also available in the Scoop_ "main" bucket for Windows users:
121
122 .. code:: powershell
123
124 scoop install gallery-dl
125
126 Homebrew
127 --------
128
129 For macOS or Linux users using Homebrew:
130
131 .. code:: bash
132
133 brew install gallery-dl
134
135 MacPorts
136 --------
137
138 For macOS users with MacPorts:
139
140 .. code:: bash
141
142 sudo port install gallery-dl
143
144 Docker
145 --------
146 Using the Dockerfile in the repository:
147
148 .. code:: bash
149
150 git clone https://codeberg.org/mikf/gallery-dl.git
151 cd gallery-dl/
152 docker build -t gallery-dl:latest .
153
154 Pulling image from `Docker Hub <https://hub.docker.com/r/mikf123/gallery-dl>`__:
155
156 .. code:: bash
157
158 docker pull mikf123/gallery-dl
159 docker tag mikf123/gallery-dl gallery-dl
160
161 Pulling image from `GitHub Container Registry <https://github.com/mikf/gallery-dl/pkgs/container/gallery-dl>`__:
162
163 .. code:: bash
164
165 docker pull ghcr.io/mikf/gallery-dl
166 docker tag ghcr.io/mikf/gallery-dl gallery-dl
167
168 Pulling *Nightly Build* images built from the latest commit by using the ``dev`` tag:
169
170 .. code:: bash
171
172 docker pull mikf123/gallery-dl:dev
173 docker pull ghcr.io/mikf/gallery-dl:dev
174
175 To run the container you will probably want to attach some directories on the host so that the config file and downloads can persist across runs.
176
177 Make sure to either download the example config file reference in the repo and place it in the mounted volume location or touch an empty file there.
178
179 If you gave the container a different tag or are using podman then make sure you adjust. Run ``docker image ls`` to check the name if you are not sure.
180
181 This will remove the container after every use so you will always have a fresh environment for it to run. If you setup a ci-cd pipeline to autobuild the container you can also add a ``--pull=newer`` flag so that when you run it docker will check to see if there is a newer container and download it before running.
182
183 .. code:: bash
184
185 docker run --rm -v $HOME/Downloads/:/gallery-dl/ -v $HOME/.config/gallery-dl/gallery-dl.conf:/etc/gallery-dl.conf -it gallery-dl:latest
186
187 You can also add an alias to your shell for "gallery-dl" or create a simple bash script and drop it somewhere in your $PATH to act as a shim for this command.
188
189 Nix and Home Manager
190 --------------------------
191
192 Adding *gallery-dl* to your system environment:
193
194 .. code:: nix
195
196 environment.systemPackages = with pkgs; [
197 gallery-dl
198 ];
199
200 Using :code:`nix-shell`
201
202 .. code:: bash
203
204 nix-shell -p gallery-dl
205
206 .. code:: bash
207
208 nix-shell -p gallery-dl --run "gallery-dl <args>"
209
210 For Home Manager users, you can manage *gallery-dl* declaratively:
211
212 .. code:: nix
213
214 programs.gallery-dl = {
215 enable = true;
216 settings = {
217 extractor.base-directory = "~/Downloads";
218 };
219 };
220
221 Alternatively, you can just add it to :code:`home.packages` if you don't want to manage it declaratively:
222
223 .. code:: nix
224
225 home.packages = with pkgs; [
226 gallery-dl
227 ];
228
229 After making these changes, simply rebuild your configuration and open a new shell to have *gallery-dl* available.
230
231 Usage
232 =====
233
234 To use *gallery-dl* simply call it with the URLs you wish to download images
235 from:
236
237 .. code:: bash
238
239 gallery-dl [OPTIONS]... URLS...
240
241 Use :code:`gallery-dl --help` or see `docs/options.md <https://codeberg.org/mikf/gallery-dl/src/branch/master/docs/options.md>`__
242 for a full list of all command-line options.
243
244
245 Examples
246 --------
247
248 Download images; in this case from danbooru via tag search for 'bonocho':
249
250 .. code:: bash
251
252 gallery-dl "https://danbooru.donmai.us/posts?tags=bonocho"
253
254
255 Get the direct URL of an image from a site supporting authentication with username & password:
256
257 .. code:: bash
258
259 gallery-dl -g -u "<username>" -p "<password>" "https://twitter.com/i/web/status/604341487988576256"
260
261
262 Filter manga chapters by chapter number and language:
263
264 .. code:: bash
265
266 gallery-dl --chapter-filter "10 <= chapter < 20" -o "lang=fr" "https://mangadex.org/title/59793dd0-a2d8-41a2-9758-8197287a8539"
267
268
269 | Search a remote resource for URLs and download images from them:
270 | (URLs for which no extractor can be found will be silently ignored)
271
272 .. code:: bash
273
274 gallery-dl "r:https://pastebin.com/raw/FLwrCYsT"
275
276
277 If a site's address is nonstandard for its extractor, you can prefix the URL with the
278 extractor's name to force the use of a specific extractor:
279
280 .. code:: bash
281
282 gallery-dl "tumblr:https://sometumblrblog.example"
283
284
285 Configuration
286 =============
287
288 Configuration files for *gallery-dl* use a JSON-based file format.
289
290
291 Documentation
292 -------------
293
294 A list of all available configuration options and their descriptions
295 can be found at `<https://gdl-org.github.io/docs/configuration.html>`__.
296
297 | For a default configuration file with available options set to their
298 default values, see `docs/gallery-dl.conf <https://codeberg.org/mikf/gallery-dl/src/branch/master/docs/gallery-dl.conf>`__.
299
300 | For a commented example with more involved settings and option usage,
301 see `docs/gallery-dl-example.conf <https://codeberg.org/mikf/gallery-dl/src/branch/master/docs/gallery-dl-example.conf>`__.
302
303
304 Locations
305 ---------
306
307 *gallery-dl* searches for configuration files in the following places:
308
309 Windows:
310 * ``%APPDATA%\gallery-dl\config.json``
311 * ``%USERPROFILE%\gallery-dl\config.json``
312 * ``%USERPROFILE%\gallery-dl.conf``
313
314 (``%USERPROFILE%`` usually refers to a user's home directory,
315 i.e. ``C:\Users\<username>\``)
316
317 Linux, macOS, etc.:
318 * ``/etc/gallery-dl.conf``
319 * ``${XDG_CONFIG_HOME}/gallery-dl/config.json``
320 * ``${HOME}/.config/gallery-dl/config.json``
321 * ``${HOME}/.gallery-dl.conf``
322
323 When run as `executable <Standalone Executable_>`__,
324 *gallery-dl* will also look for a ``gallery-dl.conf`` file
325 in the same directory as said executable.
326
327 It is possible to use more than one configuration file at a time.
328 In this case, any values from files after the first will get merged
329 into the already loaded settings and potentially override previous ones.
330
331
332 Authentication
333 ==============
334
335 Username & Password
336 -------------------
337
338 Some extractors require you to provide valid login credentials in the form of
339 a username & password pair. This is necessary for
340 ``nijie``
341 and optional for
342 ``aryion``,
343 ``danbooru``,
344 ``e621``,
345 ``exhentai``,
346 ``idolcomplex``,
347 ``imgbb``,
348 ``inkbunny``,
349 ``mangadex``,
350 ``mangoxo``,
351 ``pillowfort``,
352 ``sankaku``,
353 ``subscribestar``,
354 ``tapas``,
355 ``tsumino``,
356 ``twitter``,
357 and ``zerochan``.
358
359 You can set the necessary information in your
360 `configuration file <Configuration_>`__
361
362 .. code:: json
363
364 {
365 "extractor": {
366 "subscribestar": {
367 "username": "<username>",
368 "password": "<password>"
369 }
370 }
371 }
372
373 or you can provide them directly via the
374 :code:`-u/--username` and :code:`-p/--password` or via the
375 :code:`-o/--option` command-line options
376
377 .. code:: bash
378
379 gallery-dl -u "<username>" -p "<password>" "URL"
380 gallery-dl -o "username=<username>" -o "password=<password>" "URL"
381
382
383 Cookies
384 -------
385
386 For sites where login with username & password is not possible due to
387 CAPTCHA or similar, or has not been implemented yet, you can use the
388 cookies from a browser login session and input them into *gallery-dl*.
389
390 This can be done via the
391 `cookies <https://gdl-org.github.io/docs/configuration.html#extractor-cookies>`__
392 option in your configuration file by specifying
393
394 - | the path to a Mozilla/Netscape format cookies.txt file exported by a browser addon
395 | (e.g. `Get cookies.txt LOCALLY <https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc>`__ for Chrome,
396 `Export Cookies <https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/>`__ for Firefox)
397
398 - | a list of name-value pairs gathered from your browser's web developer tools
399 | (in `Chrome <https://developers.google.com/web/tools/chrome-devtools/storage/cookies>`__,
400 in `Firefox <https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector>`__)
401
402 - | the name of a browser to extract cookies from
403 | (supported browsers are Chromium-based ones, Firefox, and Safari)
404
405 For example:
406
407 .. code:: json
408
409 {
410 "extractor": {
411 "instagram": {
412 "cookies": "$HOME/path/to/cookies.txt"
413 },
414 "patreon": {
415 "cookies": {
416 "session_id": "K1T57EKu19TR49C51CDjOJoXNQLF7VbdVOiBrC9ye0a"
417 }
418 },
419 "twitter": {
420 "cookies": ["firefox"]
421 }
422 }
423 }
424
425 | You can also specify a cookies.txt file with
426 the :code:`--cookies` command-line option
427 | or a browser to extract cookies from with :code:`--cookies-from-browser`:
428
429 .. code:: bash
430
431 gallery-dl --cookies "$HOME/path/to/cookies.txt" "URL"
432 gallery-dl --cookies-from-browser firefox "URL"
433
434
435 OAuth
436 -----
437
438 *gallery-dl* supports user authentication via OAuth_ for some extractors.
439 This is necessary for
440 ``pixiv``
441 and optional for
442 ``deviantart``,
443 ``flickr``,
444 ``reddit``,
445 ``smugmug``,
446 ``tumblr``,
447 and ``mastodon`` instances.
448
449 Linking your account to *gallery-dl* grants it the ability to issue requests
450 on your account's behalf and enables it to access resources which would
451 otherwise be unavailable to a public user.
452
453 To do so, start by invoking it with ``oauth:<sitename>`` as an argument.
454 For example:
455
456 .. code:: bash
457
458 gallery-dl oauth:flickr
459
460 You will be sent to the site's authorization page and asked to grant read
461 access to *gallery-dl*. Authorize it and you will be shown one or more
462 "tokens", which should be added to your configuration file.
463
464 To authenticate with a ``mastodon`` instance, run *gallery-dl* with
465 ``oauth:mastodon:<instance>`` as argument. For example:
466
467 .. code:: bash
468
469 gallery-dl oauth:mastodon:pawoo.net
470 gallery-dl oauth:mastodon:https://mastodon.social/
471
472
473 .. _Python: https://www.python.org/downloads/
474 .. _PyPI: https://pypi.org/
475 .. _pip: https://pip.pypa.io/en/stable/
476 .. _Requests: https://requests.readthedocs.io/en/latest/
477 .. _FFmpeg: https://www.ffmpeg.org/
478 .. _mkvmerge: https://www.matroska.org/downloads/mkvtoolnix.html
479 .. _yt-dlp: https://github.com/yt-dlp/yt-dlp
480 .. _youtube-dl: https://ytdl-org.github.io/youtube-dl/
481 .. _PySocks: https://pypi.org/project/PySocks/
482 .. _brotli: https://github.com/google/brotli
483 .. _brotlicffi: https://github.com/python-hyper/brotlicffi
484 .. _zstandard: https://github.com/indygreg/python-zstandard
485 .. _PyYAML: https://pyyaml.org/
486 .. _toml: https://pypi.org/project/toml/
487 .. _SecretStorage: https://pypi.org/project/SecretStorage/
488 .. _Psycopg: https://www.psycopg.org/
489 .. _truststore: https://truststore.readthedocs.io/en/latest/
490 .. _Jinja: https://jinja.palletsprojects.com/
491 .. _Snapd: https://docs.snapcraft.io/installing-snapd
492 .. _OAuth: https://en.wikipedia.org/wiki/OAuth
493 .. _Chocolatey: https://chocolatey.org/install
494 .. _Scoop: https://scoop.sh/
495
496 .. |pypi| image:: https://img.shields.io/pypi/v/gallery-dl?logo=pypi&label=PyPI
497 :target: https://pypi.org/project/gallery-dl/
498
499 .. |build| image:: https://github.com/mikf/gallery-dl/actions/workflows/tests.yml/badge.svg
500 :target: https://github.com/mikf/gallery-dl/actions
501
502 .. |gitter| image:: https://badges.gitter.im/gallery-dl/main.svg
503 :target: https://gitter.im/gallery-dl/main
504
505 .. |discord| image:: https://img.shields.io/discord/1067148002722062416?logo=discord&label=Discord&color=blue
506 :target: https://discord.gg/rSzQwRvGnE