Sign inSign up

hoanghiepitvnn/youtube-dl-aio

By hoanghiepitvnn

•Updated almost 6 years ago

https://github.com/dhhiep/youtube-dl-docker

Image
0

881

hoanghiepitvnn/youtube-dl-aio repository overview

⁠Docker Youtube-DL Alpine

Download with youtube-dl⁠ using command line arguments or configuration files

⁠Features

  • Works with command line arguments to youtube-dl
  • Compatible with AMD64, 386, ARM v6/v7/v8 CPU architectures
  • Small Docker image based on
  • The container updates youtube-dl at launch if -e AUTOUPDATE=yes
  • A log file of youtube-dl execution is saved at downloads/log.txt if -e LOG=yes
  • Docker healthcheck downloading https://duckduckgo.com with wget every 10 minutes
  • The Docker Hub image is updated automatically every 3 days, so simply update your image with docker pull hoanghiepitvnn/youtube-dl-aio
  • You can receive a notification on your Android device through Gotify when the youtube-dl has finished

⁠Build and push to Docker Hub

docker-compose up --build
docker push hoanghiepitvnn/youtube-dl-aio

⁠Setup

1. Add alias commands below to ~/.bashrc or ~/.zshrc

  • Change your folder downloads at YOUTUBE_DOWNLOAD_PATH
export YOUTUBE_DOWNLOAD_PATH=/Users/hiepdinh/Data/Youtube

alias yt_files="open $YOUTUBE_DOWNLOAD_PATH"
alias yt_log="tail -f $YOUTUBE_DOWNLOAD_PATH/log.txt"
alias ytdl_base="docker run --rm --name=youtube-dl -e AUTOUPDATE=yes -v $YOUTUBE_DOWNLOAD_PATH:/downloads:rw hoanghiepitvnn/youtube-dl-aio"
alias yt_audio="ytdl_base -x --audio-format mp3 --audio-quality 0 --ignore-errors"
alias yt_video="ytdl_base -f 'bestvideo[height>=1000+height<1100]+bestaudio/bestvideo[ext=mp4]' --recode-video mp4 --postprocessor-args '-vcodec copy'"
alias yt_video2k="ytdl_base -f 'bestvideo[height>=1400+height<1500]+bestaudio/bestvideo[ext=mp4]' --recode-video mp4 --postprocessor-args '-vcodec copy'"

alias yt="yt_audio -o '/downloads/%(title)s.%(ext)s'"
alias ytl="yt_audio -o '/downloads/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'"

alias ytv="yt_video -o '/downloads/%(title)s.%(ext)s'"
alias ytv2k="yt_video2k -o '/downloads/%(title)s.%(ext)s'"
alias ytvl="yt_video -o '/downloads/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'"
alias ytv2kl="yt_video2k -o '/downloads/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s'"

2. Usage

CommandDescription
yt_filesOpen folder contain files downloaded
yt_logTail container log
ytDownload audio at best quality.
ytlDownload playlist audio at best quality.
ytvDownload video max resolution at 1080 quality
ytvlDownload playlist video max resolution at 1080 quality
ytv2kDownload video max resolution at 2K quality
ytvl2kDownload playlist video max resolution at 2K quality

Example:

yt https://www.youtube.com/watch?v=Ex8IeflzftY
ytl https://www.youtube.com/watch?v=d--UOXdbtuE&list=PLbnOcTug_qTzM9-08LJddoirbpYX18zq0

ytv https://www.youtube.com/watch?v=Ex8IeflzftY
ytvl https://www.youtube.com/watch?v=d--UOXdbtuE&list=PLbnOcTug_qTzM9-08LJddoirbpYX18zq0

ytv2k https://www.youtube.com/watch?v=Ex8IeflzftY
ytvl2k https://www.youtube.com/watch?v=d--UOXdbtuE&list=PLbnOcTug_qTzM9-08LJddoirbpYX18zq0
⁠Environment variables
Environment variableDefaultDescription
LOGyesWrites youtube-dl output to /downloads/log.txt or not
AUTOUPDATEnoUpdates youtube-dl to the latest version at launch
GOTIFYURLGotify server URL address (i.e. http://192.168.1.5:8000 or https://a.com/gotify)
GOTIFYTOKENGotify server Token
⁠Downloads directory permission issues

You can either:

  • Change the ownership and permissions of ./downloads on your host with:

    chown 1000 -R ./downloads
    chmod 700 ./downloads
    chmod -R 600 ./downloads/*
    
  • Launch the container with a different user using --user=$UID:$GID

Tag summary

Content type

Image

Digest

Size

41.5 MB

Last updated

almost 6 years ago

docker pull hoanghiepitvnn/youtube-dl-aio