Fortunately in the linux world, there is this little python utility called youtube-dl which can be run from the command line to download any YouTube file. So when you get this error, copy the URL of the YouTube file, and do this:
# sudo apt-get install youtube-dl
# youtube-dl http://www.youtube.com/watch?v=videofile001
if it doesn't work, it will complain with this verbose error
Retrieving video webpage... done.
Extracting URL "t" parameter... done.
Requesting video file... failed.
Error: unable to download video data.
Try again several times. It may be a temporary problem.
Other typical problems:
* Video no longer exists.
* Video requires age confirmation but you did not provide an account.
* You provided the account data, but it is not valid.
* The connection was cut suddenly for some reason.
* YouTube changed their system, and the program no longer works.
Try to confirm you are able to view the video using a web browser.
Use the same video URL and account information, if needed, with this program.
When using a proxy, make sure http_proxy has http://host:port format.
Try again several times and contact me if the problem persists.
You can then repeat this process over and over again, until it succeeds. Unfortunately this requires effort. And we computer users hate expending any unnecessary energy if possible. After all, focusing on the terminal, clicking the up arrow and hitting return is so so tedious.
So I wrote a little bash script to complement youtube-dl as it sports a few extra features:
- It will automatically try and retry to youtube-download the file until it is successful (thanks to $?)
- It will rename the resultant flv video filename to the current date and time, instead of the random garbage filename. (using date +%F...)
- It terminates gracefully when the user hits Ctrl-C (by setting a trap ...)
- It promotes world peace by waiting a few seconds before trying again (sleep is always good)
while [ $result = 1 ]; do
echo Attempt $i "$fname".flv
trap "echo User killing the download; exit" INT TERM
youtube-dl $1 -o "$fname".flv
if [ $result = 1 ]; then
Try it out. The most I had to wait was 24 attempts. Thats 46 keypresses saved!