Miscellany
public text v1 · immutable#!/bin/bash
url=$1
baseurl="http://youtube.com/get_video.php?"
#Get videoid and name from the page
echo -n "Downloading page..."
wget -q "$url" -O url.txt
echo "Page downloaded"
videoid=$(cat url.txt | awk -F? '/player2/ {print $2}' | sed 's/".*//')
name=$(cat url.txt | grep -m 1 title | sed -e 's|<title>YouTube - ||' -e s'|</title>||' -e 's|^.||')
rm url.txt
#download the flv
wget "$baseurl$videoid" -O "$name.flv"
echo "Video downloaded and saved as $name.flv"