lib/youtube_search.rb in youtube_search-0.1.3 vs lib/youtube_search.rb in youtube_search-0.1.4

- old
+ new

@@ -10,11 +10,11 @@ parse(xml) end def self.playlist_videos(playlist_id) playlist_id = playlist_id.sub(/^PL/, "") - xml = open("https://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?v=2").read + xml = open("http://gdata.youtube.com/feeds/api/playlists/#{playlist_id}?v=2").read parse(xml, :type => :playlist) end def self.parse(xml, options={}) elements_in(xml, 'feed/entry').map do |element| @@ -22,9 +22,11 @@ entry['video_id'] = if options[:type] == :playlist element.elements['*/yt:videoid'].text else entry['id'].split('/').last end + + entry['duration'] = element.elements['*/yt:duration'].attributes['seconds'] unless element.elements['*/yt:duration'].nil? entry end end