Table of Contents

Tube Sync

TubeSync is a self-hostable downloader for YouTube aimed at channels and playlists. After you set it up, it will automatically scan and download videos from channels you select.

It cannot be used to download single videos. As stated in the docs, to download single videos you need to create a playlist and add them to it, then add the playlist as source itself in TubeSync.

Installation

TubeSync is available as container image.

Add the usual dedicated user:

useradd -d /data/daemons/tubesync -m tubesync -g media

Create the needed folders:

mkdir /data/daemons/tubesync/config
mkdir /data/Media/YouTube
chown tubesync:tubesync /data/daemons/tubesync/config /data/Media/YouTube

Use the following docker-compose:

docker-compose.yml
services:
  tubesync:
    image: ghcr.io/meeb/tubesync:latest
    container_name: tubesync
    restart: unless-stopped
    ports:
      - 4848:4848
    volumes:
      - /data/daemons/tubesync/config:/config
      - /data/Media/YouTube:/downloads
    environment:
      - TZ=Europe/London
      - PUID=0
      - PGID=0
      - DJANGO_URL_PREFIX=/tubesync/

Pull the images:

su - tubesync
podman compose pull

TubeSync doesn't support multi-users and doesnt really support authentication (just a simple BASIC auth, which we can ignore). So it goes behind the Reverse Proxy and SSO authentication…

Reverse Proxy

Follow the The Reverse Proxy concept and the Authentication pages.

This is the working NGINX config file:

tubesync.conf
location = /tubesync {  
        return 301 https://$host/tubesync/;
}

location ^~ /tubesync/ {
        rewrite ^/tubesync/(.*) /$1 break;
        proxy_pass http://127.0.0.1:4848/tubesync/;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
}

Autostart

To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:

ln -s /etc/init.d/user-containers /etc/init.d/user-containers.tubesync

and create the following config file:

/etc/conf.d/user-containers.tubesync
USER=tubesync
DESCRIPTION="Download YouTube channels"

Add the service to the default runlevel and start it now:

rc-update add user-containers.tubesync default
rc-service user-containers.tubesync start