Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download YouTube with Ruby (sourcecode)

Tags:

ruby

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!

like image 624
Markus Avatar asked Dec 23 '09 06:12

Markus


2 Answers

gem install curltube

then run curltube <youtube-url>

https://github.com/maxogden/curltube

like image 111
Max Ogden Avatar answered Oct 22 '22 14:10

Max Ogden


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.

like image 21
Cory Schires Avatar answered Oct 22 '22 15:10

Cory Schires