
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Web UI for gallery-dl
with support for downloading videos via yt-dlp
.
This example uses the docker run
command to create the container to run the app.
docker run -d \
--name gallery-dl \
-p 9080:9080 \
-e UID=1000 \
-e GID=1000 \
-v "/path/to/config:/config" \
-v "/path/to/downloads:/gallery-dl" \
--restart on-failure \
qx6ghqkz/gallery-dl-server:latest
This is an example of a docker-compose.yaml
service definition which can be used to start a running container with the docker compose up -d
command.
services:
gallery-dl:
image: qx6ghqkz/gallery-dl-server:latest
container_name: gallery-dl
ports:
- 9080:9080
environment:
- UID=1000
- GID=1000
volumes:
- "/path/to/config:/config"
- "/path/to/downloads:/gallery-dl"
restart: on-failure
This is another example which uses a VPN client container for its networking.
services:
gallery-dl:
image: qx6ghqkz/gallery-dl-server:latest
container_name: gallery-dl
network_mode: container:vpn
environment:
- UID=1000
- GID=1000
volumes:
- "/path/to/config:/config"
- "/path/to/downloads:/gallery-dl"
restart: on-failure
Gluetun is recommended for VPN usage. See docs/docker-compose.yaml for an example.
By default, this service listens on port 9080. Any value can be used for the host port, but the CONTAINER_PORT
environment variable needs to be set to change the internal container port. This can be done using the -e
flag with docker run
or in a Docker Compose file.
For example, to run multiple instances of gallery-dl-server using a single Gluetun instance for the networking (each instance must use a different internal port), a different container port can be set for one of the containers.
services:
instance-1:
image: qx6ghqkz/gallery-dl-server:latest
container_name: day
depends_on:
- gluetun
network_mode: service:gluetun
[...]
instance-2:
image: qx6ghqkz/gallery-dl-server:latest
container_name: night
environment:
- CONTAINER_PORT=9090
depends_on:
- gluetun
network_mode: service:gluetun
[...]
gluetun:
image: qmcgaw/gluetun:latest
container_name: vpn
ports:
# instance-1
- 9080:9080
# instance-2
- 9090:9090
[...]
Make sure to mount the directory containing the configuration file rather than the file itself. This ensures changes to the configuration file are propagated to the running Docker container and it will not need to be restarted for changes to take effect. More information on this issue here.
The output download directory depends on the base-directory
in your gallery-dl configuration file. Make sure it is the absolute path /gallery-dl/
instead of the relative path ./gallery-dl/
or else the download directory will need to be mounted to /usr/src/app/gallery-dl
instead (not recommended).
The environment variables UID
and GID
can be used to change the user ID and group ID of the user running the server process. This is important because downloaded files will be owned by that user. Make sure the IDs match those of the user on the host system. The default UID:GID
is 1000:1000
when left unspecified.
If Python 3.10 or later (3.12 is recommended) is installed and on the PATH, the server can simply be run from the command line.
Clone this repository and install the dependencies located in requirements.txt
in a virtual environment, then run the command below in the root folder while inside the virtual environment. On Windows, replace python3
with python
.
python3 -m gallery_dl_server --host "0.0.0.0" --port "9080"
The command-line arguments are optional. By default, the server will run on host 0.0.0.0
and an available port will be selected if one is not provided.
To view the full list of command-line arguments, perform python3 -m gallery_dl_server -h
for help. These arguments can also be specified as environment variables.
The package and its dependencies can be installed with Python by performing pip install gallery-dl-server
. To also install optional dependencies, perform pip install gallery-dl-server[full]
. It is recommended to use a virtual environment to avoid dependency conflicts.
The package can be installed directly from the source code by performing pip install .
in the root directory of the cloned repository. Perform pip install .[full]
to install optional dependencies.
Installation allows running directly from the command line via the command gallery-dl-server
. To view the list of command-line options, perform gallery-dl-server -h
for help.
When installed, the log file will be created directly in the home directory of the user as long as the package is not found in the current working directory, in which case a logs
folder will be created there to store the log file.
On Windows, the program can be run using the prebuilt executable (.exe
) file, which includes a Python interpreter and the required Python packages. Prebuilt executables for each release can be found in Releases.
By default, any available port will be selected. To select a specific port, run the executable from the command line and specify the port, and optionally host, as command-line arguments.
gallery-dl-server.exe --host "0.0.0.0" --port "9080"
When run as an executable, the log file will be created in a logs
folder in the same directory as the executable.
Configuration files can also be loaded from the same directory as the executable. The bundled releases contain a default configuration file in JSON, YAML and TOML formats, which are all supported.
All required and optional Python and non-Python dependencies are included in the Docker image and will be available in the running container, however if you are running gallery-dl-server using any of the other methods, i.e. not with a Docker container, some dependencies may need to be installed separately.
In order to run with Python, the dependencies in requirements.txt
need to be installed in the running Python environment. These Python dependencies are included in the standalone executable and do not need to be installed.
Installation with pip
only installs the required dependencies by default. Install the gallery-dl-server[full]
package to install the optional dependencies.
Non-Python dependencies are not included. FFmpeg is strongly recommended for video and audio conversion and should be accessible from the command line, i.e. on the PATH.
There is also MKVToolNix, which includes mkvmerge for accurate Ugoira frame timecodes.
Dependencies for gallery-dl and yt-dlp are documented in their respective repositories. The majority of these are optional Python dependencies and have been accounted for, however dependencies that are strongly recommended should be installed.
Configuration of gallery-dl is as documented in the official documentation. A configuration file is required.
If run outside of Docker, the default locations will be used to search for a configuration file. If run as an executable, the current directory will also be searched for a valid configuration file.
Additionally, YAML and TOML configuration files are supported at any of the pre-defined locations.
When run with Docker, the configuration file must be mounted inside the /config
directory inside the container.
/config/gallery-dl.conf
/config/gallery-dl.{yaml, yml}
/config/gallery-dl.toml
/config/config.json
/config/config.{yaml, yml}
/config/config.toml
A default configuration file for use with gallery-dl-server has been provided and will automatically be placed in the directory mounted to /config
if no valid configuration file exists in that location.
For more information on configuration file options, see gallery-dl/docs/configuration.rst.
Any additional locations specified in the configuration file must also exist inside the Docker container. For example, if a cookies file is required, ensure it is placed in a location accessible from within the Docker container.
It is recommended to place any additional files such as archive, cache and cookies files inside the same directory mounted to /config
along with the configuration file.
Downloads can be triggered by supplying the {{url}}
of the requested video through the web UI or through the REST interface via curl, etc.
Just navigate to http://{{host}}:9080/gallery-dl
and enter the requested {{url}}
.
curl -X POST --data-urlencode "url={{url}}" http://{{host}}:9080/gallery-dl/q
fetch(`http://${host}:9080/gallery-dl/q`, {
method: "POST",
body: new URLSearchParams({
url: url
})
});
The following bookmarklet can be used from the bookmarks bar to send the current page URL to the gallery-dl-server instance running on a particular host.
javascript:(function(){var url="http://${host}:9080/gallery-dl/q",newTab=window.open(url,"_blank"),f=newTab.document.createElement("form");f.action=url;f.method="POST";var i=newTab.document.createElement("input");i.name="url";i.type="hidden";i.value=window.location.href;f.appendChild(i);newTab.document.body.appendChild(f);f.submit();})();
This service operates using the ASGI web server uvicorn
and is built on the starlette
ASGI framework.
Downloads are handled by gallery-dl
in conjunction with yt-dlp
. The integration with gallery-dl uses Python as discussed in this issue. For video downloads, gallery-dl imports and uses yt-dlp.
The Docker image is based on python:3.12-alpine
, which in turn is based on alpine
.
FAQs
Web UI for downloading media with gallery-dl and yt-dlp.
We found that gallery-dl-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.