1

I am looking for a download manager running in CLI (terminal).

Tool should solve the following purpose.

  1. Take a list of YouTube URL as input / take a URL-list from a file.

  2. Should pause and resume download when the network connection is interrupted.

  3. Should run in terminal. I am running this on a headless media server.

I use a youtube-dl nodejs script now. But the script lacks connection monitoring and download integrity check, download resume feature.

I tried Extreme Download manager and it wouldn't run headless.

Any inputs for achieving the same is appreciated.

2

Two while loop in bash should be enough:

while ! youtube-dl --batch-file /tmp/yt -i -c --socket-timeout 5; do while ! ping -c 1 -W 1 google.com; do echo "Network interface may down, please check your network"; sleep 10; done; echo "Network up but got url failed before, re-loop file after 5 seconds."; sleep 5; done

Explanation:

  • youtube-dl is python package available to install via ordinary package manager such as apt.
  • /tmp/yt file contains list of urls line by line.
  • -i means continue pick next url in the file if encounter url invalid error (but not socket error, which will go into ping's "failed & wait for network up" loop)
  • -c means force resume of partially downloaded files. The filename should has consistent format for resume to work (i.e. you can't change youtube-dl format next time and expect resume to work). I personally use -o './%(title)s-%(upload_date)s-%(id)s.%(ext)s' format
  • I personally also add --no-mtime to ensure the file "touch" (useful if I want to list file sort by download time instead of video update time).
1

Any command-line HTTP client should be useful. On POSIX systems, consider GNU wget or curl (and, if the protocol is FTP, one of the numerous FTP command line clients such as ncftp).

You could also code something by yourself, using some HTTP client library like libcurl (and many scripting languages, e.g. Python, Guile, Perl, etc... have numerous HTTP client facilities). Be sure to learn a bit more about HTTP and its cookies.

You could find (for Linux) some youtube specific command-line tools.

  • wget is not technically a download manager nor they identify themself as such – 55597 Nov 30 '17 at 14:16
  • You don't define what is a download manager. I never heard that expression before (specially with headless) – Basile Starynkevitch Nov 30 '17 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.