Skip to content

gieldemeulemeester/youtube-dl-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub license

youtube-dl-server

Flask application for youtube-dl to download youtube videos. The docker image is based on python:alpine.

screenshot

Running

Docker

This example uses the docker build command to build the image and the docker run command to create a container from that image. The container exposes port 5000 and volume /youtube-dl.

docker build --tag youtube-dl-server .
docker run -d --name youtube-dl -p 5000:5000 -v ~/volumes/youtube-dl:/youtube-dl youtube-dl-server

Docker Compose

This is an example service definition that could be added in docker-compose.yml.

youtube-dl:
  container_name: youtube-dl
  build: ./services/youtube-dl/
  volumes:
    - ./volumes/youtube-dl:/youtube-dl
  ports:
    - 5000:5000
  restart: unless-stopped

Optionally, you could make the download directory accessible with samba as shown in the example below.

samba:
  image: dperson/samba:latest
  environment:
    - USER=<insert user>;<insert password>
    - SHARE=youtube-dl;/mnt/youtube-dl;yes;no;yes;<insert user>;<insert user>
  volumes:
    - ./volumes/youtube-dl:/mnt/youtube-dl
  ports:
    - 137:137/udp
    - 138:138/udp
    - 139:139/tcp
    - 445:445/tcp
  restart: unless-stopped

Then run docker-compose up -d --build.

Python

If you have python 3 installed in your PATH you can simply run like this, providing optional environment variable overrides inline.

sudo YDL_SERVER_PORT=8123 python3 -u ./flask-server.py

Usage

Web

Just navigate to http://{{host}}:5000/ and paste the video url or select .webloc files to the video's and click the Submit button. Navigate to the Jobs tab to track download progress.

Curl

curl -X POST --data-urlencode "url={{url}}" http://{{host}}:5000/enqueue-url

Fetch

fetch(`http://${host}:5000/enqueue-url`, {
  method: "POST",
  body: new URLSearchParams({
    url: url,
    format: "bestvideo"
  }),
});

Bookmarklet

Add the following bookmarklet to your bookmark bar so you can conviently send the current page url to your youtube-dl-server instance.

javascript:!function(){fetch("http://${host}:5000/enqueue-url",{body:new URLSearchParams({url:window.location.href,format:"bestvideo"}),method:"POST"})}();

About

Dockerized web application for downloading YouTube videos.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 41.1%
  • HTML 35.6%
  • JavaScript 19.4%
  • CSS 2.4%
  • Dockerfile 1.5%