Web GUI for yt-dlp with playlist & channel support.
YTPTube started as a fork of meTube, Since then it went under heavy changes, and it supports many new features.
- Multi-downloads support.
- Handle live streams.
- Schedule Channels or Playlists to be downloaded automatically at a specific time.
- Send notification to targets based on specified events.
- Support per link
yt-dlp JSON config or cli options
,cookies
&output format
. - Queue multiple URLs separated by comma.
- A built in video player that can play any video file regardless of the format. With support for sidecar external subtitles.
- New
POST /api/history
endpoint that allow one or multiple links to be sent at the same time. - New
GET /api/history/add?url=http://..
endpoint that allow to add single item via GET request. - Completely redesigned the frontend UI.
- Switched out of binary file storage in favor of SQLite.
- Basic Authentication support.
- Support for curl_cffi, see yt-dlp documentation
- Support for both advanced and basic mode for WebUI.
For more API endpoints, please refer to the API documentation.
Your yt-dlp
config should include the following options for optimal working conditions.
{
"windowsfilenames": true,
"live_from_start": true,
"format_sort": [
"codec:avc:m4a"
]
}
- Note, the
format_sort
, forces YouTube to use x264 instead of vp9 codec, you can ignore it if you want. i prefer the media in x264.
docker run -d --rm --name ytptube -p 8081:8081 -v ./config:/config:rw -v ./downloads:/downloads:rw ghcr.io/arabcoders/ytptube
services:
ytptube:
user: "1000:1000"
image: ghcr.io/arabcoders/ytptube
container_name: ytptube
restart: unless-stopped
ports:
- "8081:8081"
volumes:
- ./config:/config:rw
- ./downloads:/downloads:rw
tmpfs:
- /tmp
Certain values can be set via environment variables, using the -e
parameter on the docker command line, or the environment:
section in compose.yaml
file.
- YTP_CONFIG_PATH: path to where the queue persistence files will be saved. Defaults to
/config
in the docker image, and./var/config
otherwise. - YTP_DOWNLOAD_PATH: path to where the downloads will be saved. Defaults to
/downloads
in the docker image, and./var/downloads
otherwise. - YTP_TEMP_PATH: path where intermediary download files will be saved. Defaults to
/tmp
in the docker image, and./var/tmp
otherwise. - YTP_TEMP_KEEP: Whether to keep the Individual video temp directory or remove it. Defaults to
false
. - YTP_OUTPUT_TEMPLATE: the template for the filenames of the downloaded videos, formatted according to this spec. Defaults to
%(title)s.%(ext)s
. This will be the default for all downloads unless the request include output template. - YTP_OUTPUT_TEMPLATE_CHAPTER: the template for the filenames of the downloaded videos, when split into chapters via postprocessors, formatted according to this spec. Defaults to
%(title)s - %(section_number)s %(section_title)s.%(ext)s.
- YTP_KEEP_ARCHIVE: Whether to keep history of downloaded videos to prevent downloading same file multiple times. Defaults to
true
. - YTP_YTDL_DEBUG: Whether to turn debug logging for the internal
yt-dlp
package. Defaults tofalse
. - YTP_ALLOW_MANIFESTLESS: Allow
yt-dlp
to download live streams videos which are yet to be processed by YouTube. Defaults tofalse
- YTP_HOST: Which IP address to bind to. Defaults to
0.0.0.0
. - YTP_PORT: Which port to bind to. Defaults to
8081
. - YTP_LOG_LEVEL: Log level. Defaults to
info
. - YTP_MAX_WORKERS: How many works to use for downloads. Defaults to
1
. - YTP_STREAMER_VCODEC: The video codec to use for in-browser streaming. Defaults to
libx264
. - YTP_STREAMER_ACODEC: The audio codec to use for in-browser streaming. Defaults to
aac
. - YTP_AUTH_USERNAME: Username for basic authentication. Defaults open for all
- YTP_AUTH_PASSWORD: Password for basic authentication. Defaults open for all.
- YTP_REMOVE_FILES: Whether to remove the actual downloaded file when clicking the remove button. Defaults to
false
. - YTP_ACCESS_LOG: Whether to log access to the web server. Defaults to
true
. - YTP_DEBUG: Whether to turn on debug mode. Defaults to
false
. - YTP_DEBUGPY_PORT: The port to use for the debugpy debugger. Defaults to
5678
. - YTP_SOCKET_TIMEOUT: The timeout for the yt-dlp socket connection variable. Defaults to
30
. - YTP_EXTRACT_INFO_TIMEOUT: The timeout for extracting video information. Defaults to
70
. - YTP_DB_FILE: The path to the SQLite database file. Defaults to
{config_path}/ytptube.db
. - YTP_MANUAL_ARCHIVE: The path to the manual archive file. Defaults to
{config_path}/manual_archive.log
. - YTP_UI_UPDATE_TITLE: Whether to update the title of the page with the current stats. Defaults to
true
. - YTP_PIP_PACKAGES: a space separated list of pip packages to install. Defaults to
""
, you can also use{config_path}/pip.txt
to install the packages. - YTP_PIP_IGNORE_UPDATES: Do not update the custom pip packages. Defaults to
false
. - YTP_BASIC_MODE: Whether to run WebUI in basic mode. Defaults to
false
. In basic mode, A minimal UI will be shown, the majority of the features will be disabled. - YTP_DEFAULT_PRESET: The default preset to use for the download. Defaults to
default
. - YTP_INSTANCE_TITLE: The title of the instance. Defaults to empty string.
It's advisable to run YTPTube behind a reverse proxy, if authentication and/or HTTPS support are required.
location /ytptube/ {
proxy_pass http://ytptube:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
Note: the extra proxy_set_header
directives are there to make web socket connection work.
The following example Caddyfile gets a reverse proxy going behind caddy.
example.com {
route /ytptube/* {
uri strip_prefix ytptube
reverse_proxy ytptube:8081
}
}
The engine which powers the actual video downloads in YTPTube is yt-dlp. Since video sites regularly change their layouts, frequent updates of yt-dlp are required to keep up.
There's an automatic nightly build of YTPTube which looks for a new version of yt-dlp, and if one exists, the build pulls it and publishes an updated docker image. Therefore, in order to keep up with the changes, it's recommended that you update your YTPTube container regularly with the latest image.
Before asking a question or submitting an issue for YTPTube, please remember that YTPTube is only a UI for yt-dlp. Any issues you might be experiencing with authentication to video websites, postprocessing, permissions, other yt-dlp options
configurations which seem not to work, or anything else that concerns the workings of the underlying yt-dlp library, need not be opened on the YTPTube project. In order to debug and troubleshoot them, it's advised to try using the yt-dlp binary directly first, bypassing the UI, and once that is working, importing the options that worked for you into yt-dlp options
file.
In order to test with the yt-dlp command directly, you can either download it and run it locally, or for a better simulation of its actual conditions, you can run it within the YTPTube container itself.
Simply go to Console
button in your navbar and directly use the yt-dlp command.
Assuming your YTPTube container is called ytptube
, run the following on your Docker host to get a shell inside the container:
docker exec -ti ytptube bash
cd /downloads
yt-dlp ....
Once there, you can use the yt-dlp command freely.
Make sure you have nodejs
and Python 3.11+
installed.
cd ytptube/frontend
# install Vue and build the UI
npm install
npm run build
# install python dependencies
cd ..
python -m venv .venv
source .venv/bin/activate
pip3 install pipenv
pipenv install
# run
python app/main.py
A Docker image can be built locally (it will build the UI too):
docker build . -t ytptube
The config/ytdlp.json
, is a json file which can be used to alter the default yt-dlp
config settings. For example these are the options i personally use,
{
// Make the final filename windows compatible.
"windowsfilenames": true,
// Write subtitles if the stream has them.
"writesubtitles": true,
// Write info.json file for each download. It can be used by many tools to generate info etc.
"writeinfojson": true,
// Write thumbnail if available.
"writethumbnail": true,
// Do not download automatically generated subtitles.
"writeautomaticsub": false,
// MP4 is limited with the codecs we use, so "mkv" make sense.
"merge_output_format": "mkv",
// Record live stream from the start.
"live_from_start": true,
// For YouTube try to force H264 video codec & AAC audio.
"format_sort": [
"codec:avc:m4a"
],
// Your choice of subtitle languages to download.
"subtitleslangs": [ "en", "ar" ],
// postprocessors to run on the file
"postprocessors": [
// this processor convert the downloaded thumbnail to jpg.
{
"key": "FFmpegThumbnailsConvertor",
"format": "jpg"
},
// This processor convert subtitles to srt format.
{
"key": "FFmpegSubtitlesConvertor",
"format": "srt"
},
// This processor embed metadata & info.json file into the final mkv file.
{
"key": "FFmpegMetadata",
"add_infojson": true,
"add_metadata": true
},
// This process embed subtitles into the final file if it doesn't have subtitles embedded.
{
"key": "FFmpegEmbedSubtitle",
"already_have_subtitle": false
}
]
}
The options can be fount at yt-dlp YoutubeDL.py file. And for the postprocessors at yt-dlp postprocessor.
Note
You can use the yt-dlp json config
box in the new Download page to convert your cli options to json format.
The config/presets.json
, is a json file, which can be used to add custom presets for selection in WebUI.
The file is supposed to be an array of objects, each object represent a preset, the schema for the object is as the following.
[
{
// (name: string) - REQUIRED - The preset name.
"name": "My super preset",
// (format: string) - REQUIRED - The required yt-dlp format. i.e. -f option in yt-dlp cli.
"format": "best",
// (postprocessors: array) - OPTIONAL - The postprocessors to run on the file. if it's preset or set to empty array, it will override the default postprocessors.
"postprocessors": [
// for example to embed thumbnail.
{
"key": "EmbedThumbnail",
"already_have_thumbnail": false
}
],
// (args: dict) - OPTIONAL - Extra yt-dlp arguments to pass to yt-dlp.
"args": {
// (key: string) - REQUIRED - The yt-dlp argument key.
"writethumbnail": true
}
},
{
// another preset, etc...
}
]
For more expanded example please take look at the default presets file found in app/library/presets.json.
To enable basic authentication, set the YTP_AUTH_USERNAME
and YTP_AUTH_PASSWORD
environment variables. And restart the container.
This will prompt the user to enter the username and password before accessing the web interface/API.
As this is a simple basic authentication, if your browser doesn't show the prompt, you can use the following URL
http://username:password@your_ytptube_url:port
What does the basic mode do? it hides the the following features from the WebUI.
It disables everything except the theme switcher
and reload
button.
- The form will always be visible and un-collapsible.
- Everything except the
URL
andAdd
button will be disabled and hidden. - The preset will be the default preset, which can be specified via
YTP_DEFAULT_PRESET
environment variable. - The output template will be the default template which can be specified via
YTP_OUTPUT_TEMPLATE
environment variable. - The download path will be the default download path which can be specified via
YTP_DOWNLOAD_PATH
environment variable.
Disables the Information
button.
If you have short or quick questions, you are free to join my discord server and ask the question. keep in mind it's solo project, as such it might take me a bit of time to reply.
If you feel like donating and appreciate my work, you can do so by donating to children charity. For example Make-A-Wish. I Personally don't need the money, but I do appreciate the gesture. Making a child happy is more worthwhile.