Last active
December 28, 2015 23:59
-
-
Save kimihito/7582904 to your computer and use it in GitHub Desktop.
1日ごとで見られたYouTubeのデータを取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'nokogiri' | |
uri = URI("https://gdata.youtube.com/feeds/api/standardfeeds/JP/most_recent?time=today&v=2").read | |
docs = Nokogiri::XML(uri) | |
entry = docs.search("entry") | |
entry.each do |attr| | |
puts attr.search("title") | |
puts attr.xpath("media:group").xpath("media:thumbnail").attr("url") | |
puts attr.xpath("media:group").xpath("yt:videoid").text | |
puts attr.xpath("media:group").xpath("media:category").text | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment