Here’s a oneliner bash script that uses wget, sed, awk, and tr to download a video from YouTube.

Tested on Debian and Mac. Just put the code below in a file and make your file executable using:

chmod +x yourfile.sh

#!/bin/bash

## Two arguments
# $1 Youtube URL
# $2 You name for the video
wget -c –no-check-certificate –user-agent=”" $1 -qO- | \
sed ‘s/\\u0026/\&/g’| \
awk ‘/fmt_url_map/{gsub(/[\|\"]/,”\n”);print}’ | \
sed -n “/^fmt_url_map/,/videoplayback/p” | \
sed -e :a -e ‘$q;N;2,$D;ba’ | tr -d ‘\n’ | \
sed -e “s/\(.*\),\(.\)\{1,3\}/\1/;s/\\\//g” | \
wget -c –no-check-certificate –user-agent=”" -i – -O $2.flv

After putting in a file and making it executable just go get your YouTube url and fire off the download.
Here’s an example.

./youtube_downloader.sh ‘http://www.youtube.com/watch?v=FRWLfY7hMgQ’ filename_to_save

This will make the file filename_to_save.flv in your dir.

Enjoy.

Page 1 of 11