Skip to main content

A web version of youtube-dl

Project description

PyPi Package Compatible Python Versions

About

This is a project that builds on pytube to provide a simple web-interface for downloading audio from Youtube. It’s primary purpose is to provide a LAN HTTP accessible method of saving audio to a local device.

This project is built using python’s asyncio libraries and packages include FastAPI, janus, and uvicorn. It’s also an example of how to work with pytube’s python sdk and enable asynchronous downloads in the context of a web-app.

Files are downloaded using an API endpoint and then retrived from the application’s static files directory using Javascript’s fetch API. Download progress is presented via a websocket connection.

Installation

pip install web-youtube-dl

Running

CLI

Installing this project will give you access to two CLI tools, each with a separate purpose:

  • web-youtube-dl-cli
    Useful for simply downloading the highest possible quality audio of a song.
    Simply provide the URL and an .mp3 will be downloaded to current working
    directory or to the value of the YT_DOWNLOAD_PATH environment variable
  • web-youtube-dl-web
    Useful for running the web service on the local machine. It will
    listen to all local network connections on port 5000 (or whatever port is
    defined in the environment variable YT_DOWNLOAD_PORT).

Docker

This project can optionally be run and managed as a Docker container.

Build the Docker image

docker build . -t  web-youtube-dl:latest --force-rm

Or, using the project’s Makefile

make image

Run the service

When running the service via Docker, you can configure where it stores downloaded songs by default and the port the service listens on by setting the appropriate environment variables.

To configure the port, set the environment variable YT_DOWNLOAD_PORT to some other numerical value.

To configure the download path, set the environment variable YT_DOWNLOAD_PATH to some other filesystem path. Note that an unprivileged user must have access to writing to this location. By default, this is set to tmp and does not really need to be changed.

docker-compose up -d

Or, using the project’s Makefile

make compose

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web-youtube-dl-0.2.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

web_youtube_dl-0.2.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file web-youtube-dl-0.2.0.tar.gz.

File metadata

  • Download URL: web-youtube-dl-0.2.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.7.13 Linux/5.13.0-1025-azure

File hashes

Hashes for web-youtube-dl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 71d021d3bb5400ea451c7a3e731af67e2a632279e0a42d997d6a5dc56d032fa7
MD5 52cceabd96dfac5e87c3c6b3ea92fa8b
BLAKE2b-256 5f2b3971125c534d5d5b655b87e72ca81a2a320a3a647671547a4d026ba10141

See more details on using hashes here.

File details

Details for the file web_youtube_dl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: web_youtube_dl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.7.13 Linux/5.13.0-1025-azure

File hashes

Hashes for web_youtube_dl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83406e704596b91b912edbea7844efdeba41571f3019b289ffd3ea266a9558e9
MD5 af67b2d180fbca46555ee02c3d3edf01
BLAKE2b-256 b9cb79033f846e62915b0957f27d4e14473cd01415990d6c0ba8ca721a5d2db6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page