ytdlp Sever is a API Endpoint for launch yt-dlp on your network.
Prepair Ubuntu Server and run here.
sudo apt update
sudo apt install docker.io cifs-utils
sudo gpasswd --add $USER docker
newgrp docker
sudo curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-composeCustomise to your environment.
sudo mkdir -p /mnt/video
## if samba
sudo tee -a "//<your windows ipaddr>/<your sharing path> /mnt/video cifs nofail,_netdev,x-systemd.automount,user=<your username>,password=<your password>,file_mode=0666,dir_mode=0777 0 0" /etc/fstab
sudo mount -aStart Service.
docker-compose up -d --scale worker=4Now you can download video by curl -X POST "http://<Your Server IPaddr>:5000/ytdlp" -d "{\"url\": \"https://www.youtube.com/watch?v=XXXXXXXXXX\"}"
docker.io may charge a fee in the future.
sudo apt update
sudo apt install docker.io
sudo gpasswd --add $USER docker
newgrp docker
## if docker soket is down, reboot
sudo rebootLaunch in ubuntu 22.04 LTS.
https://matsuand.github.io/docs.docker.jp.onthefly/compose/install/
sudo curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --versionubuntu@devsv:~/git/ytdlpServer
>> docker-compose --version
Docker Compose version v2.4.1
Install for mount windows samba share directory if you need.
sudo apt install cifs-utilsCreate mout directory
sudo mkdir -p /mnt/videoif you need not hide your credential, you can setup fstab with hardcode credential.
ex. mount ¥¥192.168.3.120¥Videos, user name is samba, password is samba. add that to /etc/fstab
//192.168.3.120/Videos /mnt/video cifs nofail,_netdev,x-systemd.automount,user=samba,password=samba,file_mode=0666,dir_mode=0777 0 0
If not, create samba credential directory and credential file for connect windows share directory.
sudo mkdir -p /etc/smb-credentials/
cat << EOF | sudo tee /etc/smb-credentials/.pw
username=user
password=passwd
EOF...And prevent access all user except root.
sudo chmod +600 /etc/smb-credentials/.pwEdit /etc/fstab for mount on startup.
ex. mount ¥¥192.168.3.120¥Videos add...
//192.168.3.120/Videos /mnt/video cifs nofail,_netdev,x-systemd.automount,credentials=/etc/smb-credentials/.pw,file_mode=0666,dir_mode=0777 0 0
Try mount directory.
sudo mount -aBuild container image.
docker-compose buildAttention: Very long to build, wait a moment.
Edit docker-compose.yml set your directory to volumes for download.
worker:
build:
dockerfile: ./Dockerfile.worker
depends_on:
- redis
environment:
RQ_REDIS_URL: redis://redis
volumes:
- /mnt/video:/download
working_dir: /downloadLauch container with mounting download path.
## set scale of workers.
docker-compose up -d --scale worker=4
## show log
docker-compose logs -f-
send request like:
curl -X POST "http://localhost:5000/ytdlp" -d "{\"url\": "https://www.youtube.com/watch?v=XXXXXXXXXX", \"format\": \"bv*+ba/best\"}
-
wait a minute and will generate video to your directory.
To make it easy, I recommend create iOS Shortcut like that...
Or use it with edit: video-dl.shortcut
| option | type | description |
|---|---|---|
| url | string | video URL, input of yt-dlp |
| format | string | format setting, input of yt-dlp. |
| origts | boolean | if this parameter defined, do not update creation timestamp to download date. |
| category | string | put video to sub-directory. create dir if not exist . |
| language | string | language setting for dubbed video, defalut "ja" |
