class FeedmeYoutubes::Feed
feed
Attributes
entries[RW]
url[R]
Public Class Methods
new(author)
click to toggle source
# File lib/feedme_youtubes.rb, line 45 def initialize(author) @author = author @feed_url = "https://gdata.youtube.com/feeds/api/users/#{author}/uploads" @entries = [] end
Public Instance Methods
update()
click to toggle source
# File lib/feedme_youtubes.rb, line 51 def update update_feed update_info update_entries end
update_entries()
click to toggle source
# File lib/feedme_youtubes.rb, line 66 def update_entries @feed.xpath("//entry").each do |entry| title = entry.xpath("title").text published = Date.parse(entry.xpath("published").text) link = entry.xpath("link[@rel='alternate']").text @entries << Entry.new(title: title, published: published, link: link) end end
update_feed()
click to toggle source
# File lib/feedme_youtubes.rb, line 57 def update_feed @feed = Nokogiri::HTML(open(@feed_url)) end
update_info()
click to toggle source
# File lib/feedme_youtubes.rb, line 61 def update_info @url = @feed.xpath('id').text @updated = @feed.xpath('updated') end