Skip to content

toru2220/youtube-dl-you-get-server

Repository files navigation

Docker Stars Shield Docker Pulls Shield GitHub license

youtube-dl-you-get-server

Very spartan Web and REST interface for downloading youtube videos onto a server. starlette + youtube-dl + you-get

screenshot

Running

Docker CLI

This example uses the docker run command to create the container to run the app. Here we also use host networking for simplicity. Also note the -v argument. This directory will be used to output the resulting videos

docker run -d --net="host" --name youtube-dl -v /home/core/youtube-dl:/data toru2220/youtube-dl-you-get-server

Docker Compose

This is an example service definition that could be put in docker-compose.yml. This service uses a VPN client container for its networking.

  youtube-dl:
    image: "toru2220/youtube-dl-you-get-server"
    network_mode: "service:vpn"
    volumes:
      - /home/core/youtube-dl:/data
      - /home/core/youtube-dl2:/data2
      - /home/core/youtube-dl3:/data3
    restart: always

Python

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

YDL_SERVER_PORT=8123 YDL_UPDATE_TIME=False python3 -u ./youtube-dl-server.py

In this example, YDL_UPDATE_TIME=False is the same as the command line option --no-mtime.

Usage

Start a download remotely

Downloads can be triggered by supplying the {{url}} of the requested video through the Web UI or through the REST interface via curl, etc.

HTML

Just navigate to http://{{host}}:8080/youtube-dl and enter the requested {{url}}.

Curl

curl -X POST --data-urlencode "url={{url}}" http://{{host}}:8080/youtube-dl/q

Fetch

fetch(`http://${host}:8080/youtube-dl/q`, {
  method: "POST",
  body: new URLSearchParams({
    url: url,
    format: "bestvideo",
    savelocation: "data",
  }),
});

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}:8080/youtube-dl/q",{body:new URLSearchParams({url:window.location.href,format:"bestvideo",savelocation:"data"}),method:"POST"})}();

Implementation

The server uses starlette for the web framework and youtube-dl to handle the downloading. The integration with youtube-dl makes use of their python api.

This docker image is based on python:alpine and consequently alpine:3.8.

About

youtube-dl and you-get(twitter) server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published