Skip to content

Instantly share code, notes, and snippets.

@electronicbites
Created March 11, 2009 22:05
Show Gist options
  • Save electronicbites/77777 to your computer and use it in GitHub Desktop.
Save electronicbites/77777 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'hpricot'
require 'net/http'
HOST = "gdata.youtube.com"
SITE = "/feeds/api"
def upload_time(youtubeid)
request = Net::HTTP::Get.new("#{SITE}/videos?q=#{youtubeid}&safeSearch=none")
request.add_field 'GData-Version', '2'
Net::HTTP.start("#{HOST}", 80) do |http|
(Hpricot(http.request(request).body)/'entry'/'yt:uploaded').inner_html
end
end
puts upload_time('001XYCqJU-Q')
puts upload_time('001Vzudt-xo')
puts upload_time('0_0_1xD_T2k')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment