Using some, for unix based systems, common tools to download movies and optionally ripping the audio from them.

USAGE: youtube-downloader <youtube-url> [command]

COMMANDS:

  • audio Downloads the video to a fifo-pipe, rips the audio and removes the video. If the file has already been downloaded the audio will be ripped but the file will be not be removed.

  • rip or all Downloads the video and rips the audio

  • download prints the download url and title, separated with a tab

  • url prints the download url

With no command set it will download the video.

EDITING FILENAME: This script is set to use the Ruby Readline library, I’ve not found a way to add a default value to the line to be read in.

But I’ve added the default title toe Readline history buffer so press the up arrow key on your keyboard to get it filled in so you can change it.

DEPENDENCIES:

  • cURL, fetch or wget. We try to be smart and choose a good one depending on the running system so this shouldn’t be to big a deal.

  • ffmpeg, for ripping the audio

  • hpricot gem, if you install through rubygems it will be installed automatically

  • htmlentities gem

INSTALLATION: Make sure you can download gems from gemcutter.org and then And then:

# gem install youtube-downloader

CONFIGURATION: In your home directory create a file named .youtube-downloader with these values:


# To download the files to the current directory set to . :download_dir: . :music_dir: . :temp_dir: /tmp :file_extension: flv

# If we want the timestamp on the files to be time of download instead # of time of the file :touch: true

CHANGES 1.2

  • Youtubes new site design moved the script-tags around so we couldn’t find the correct URL

  • Fixed a bug where if you set your own filename instead of using the videos name from Youtube it wouldn’t be used

1.1

  • Switched over to using hpricot for finding the parts of the document were the data I need to download the video are

  • Added the HTML Entities library to uncode the various HTML parts in the title of the video

  • Using ffmpeg instead of lame/mplayer for audio ripping and encoding

  • Extracted the url finding part of the script into a class of its own

TODO 2.0

  • Add support for downloading different qualities of a video. 360p, 720p, 1080p etc