Educated guess
It would be best to specify the cache directory and use the -c flag to force the download to continue, if possible.
Source: youtube-dl page
--cache-dir DIR Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME /youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfusβ cated signatures) are cached, but that may change. -c, --continue Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.
Alternative solution
If you want to try python, this script should do what you need with a little tweaking.
import sys import youtube_dl def download_no_matter_what(url): try: youtube_dl.YoutubeDL(options).download([url]) except OSError: download_no_matter_what(url) except KeyboardInterrupt: sys.exit() if __name__ == '__main__':
Link for youtube_dl API: https://github.com/rg3/youtube-dl/blob/master/README.md#readme
source share