How to fetch youtube video with it开发者_如何学运维s name fro, youtube when you have url of the video.
Try youtube_it gem
You can also try quvi gem which can extract most metadata from many media sites. For example you can get URLs of streams and pass them to downloader of your choice:
require 'quvi'
q = Quvi::Handle.new
media = q.parse_media("https://soundcloud.com/tasod/taso-du-val-originally-superior-ep-1")
media[:streams].map{ |m| m[:url] }
# => ["http://media.soundcloud.com/stream/U203a5DmFj9U?stream_token=1Q17x"]
you can use the standard open
when including openuri like this:
require 'open-uri'
youtube_video = open('http://www.yotube.com/whatever') {|f| f.read }
精彩评论