Hi! I wish to download a video from YouTube and then extract its audio. Can anyone point me to some Ruby code to download a video? Thanks!
Not sure how you would extract audio, but Ruby has many good scraping/mining libraries. You can use these to automate a browser and get scrape the data you need (e.g. the video embed code).
I recommend using a combination of mechanize and hpricot but here's a fairly comprehensive list:
Hpricot Mechanize Scrapi Scrubyt Nokogiri
You might also try Rio for downloading files/videos:
Rio: http://rio.rubyforge.org/
Hope it helps.
Here is some ruby code to download a youtube video. Unfortunely the library is written in python.
system("youtube-dl", "-o", filename, youtube_url)
You can extract the audio with the following
system("mplayer", "-dumpaudio", "-dumpfile", audo_filename, filename)
Here's a link to some Ruby source code that will download the FLV from youtube:
http://www.rorcraft.com/2008/08/29/download-youtube-videos-with-ruby/
I haven't tried it out myself, but it's worth a shot.
There's a more recent video downloader project here on github that allows you to grab flash video from different sites.