MeTube: A selfhosted WebUI for yt-dlp
Most people should have heard of youtube-dl and the legal battles around it. As the content industry only saw it as a tool for piracy. And yes, while many may use it solely for that there is also the big group of people who want to download single TV news articles (videos) or documentaries produced by public-service broadcasting companies such as ARTE, ARD, ZDF - to name a few German ones. youtube-dl was sued into oblivion, but as it was OpenSource other forks were created with yt-dlp being the currently active one.
yt-dlp however is not just the only program offering this kind of functionality. As such there is the program MediathekView which gathers all senders program information and allows for the easy download of all content. Why MediathekView isn't sued? It only allows the download of content from the online Mediathek of public broadcasting companies, such as: ARD, ZDF, Arte, 3Sat, SWR, BR, MDR, NDR, WDR, HR, RBB, ORF and SRF. Which are all public broadcasting TV senders from Germany, Austria and Switzerland. Hence no problems with 3rd party rights do exist.
But... MediathekView is a local application and I like to have a simple web-frontend useable from any device. Introducing MeTube it's a web-frontend build around yt-dlp and provided as a Docker container. The WebUI itself is minimalistic but does its job.
In my environment MeTube is configured to save videos on a share on my NAS. Storing the videos in the correct folder automatically.
Mounting the CIFS-Share is done via the following line in /etc/fstab:
root@portainer:~# cat /etc/fstab
# /etc/fstab: static file system information.
[...]
# Metube Mount
//ip.ip.ip.ip/video/yt-dlp /mnt/yt-dlp cifs rw,vers=3.0,credentials=/root/.fileserver_smbcredentials,dir_mode=0775,file_mode=0775,uid=1002,gid=1002
Then we use that local mount for the /downloads folder of the Docker container. After the first start I learned I additionally need to explicitly store the TEMP_DIR and STATE_DIR on local volumes on the Docker container host itself. After that I fixed the healthcheck as it is hardcoded for HTTP.
services:
metube:
image: ghcr.io/alexta69/metube
container_name: metube
restart: unless-stopped
ports:
- "8081:8081"
volumes:
# On CIFS-Share, mounted via /etc/fstab
- /mnt/yt-dlp:/downloads
# HTTPS
- /opt/docker/certs/host.lan.crt:/ssl/crt.pem
- /opt/docker/certs/host.lan.key:/ssl/key.pem
# Local volumes to make CIFS-Share work
- /opt/docker/metube/temp:/temporary
- /opt/docker/metube/state:/state
environment:
# Created local user metube for correct filerights
- PUID=1002
- PGID=1002
# HTTPS
- HTTPS=true
- CERTFILE=/ssl/crt.pem
- KEYFILE=/ssl/key.pem
# Needed as our /downloads folder is located on a CIFS-Share
- TEMP_DIR=/temporary
- STATE_DIR=/state
- DELETE_FILE_ON_TRASHCAN=true
# Internal container healthcheck is hardcoded for HTTP
healthcheck:
test: ["CMD-SHELL", "curl -fsS --insecure -m 2 https://localhost:8081/ || exit 1"]
interval: 60s
timeout: 10s
retries: 3
start_period: 40s
(Click to enlarge)
(Click to enlarge)
Huh? What? I use all kinds of strange ports in my home network and never got that error message.