Class: YouTubeIt::Parser::PlaylistFeedParser
- Inherits:
-
FeedParser
- Object
- FeedParser
- YouTubeIt::Parser::PlaylistFeedParser
- Defined in:
- lib/youtube_it/parser.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods inherited from FeedParser
#initialize, #parse, #parse_single_entry, #parse_videos, #remove_bom
Constructor Details
This class inherits a constructor from YouTubeIt::Parser::FeedParser
Instance Method Details
#parse_content(content) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/youtube_it/parser.rb', line 80 def parse_content(content) xml = Nokogiri::XML(content.body) entry = xml.at("feed") || xml.at("entry") YouTubeIt::Model::Playlist.new( :title => entry.at("title") && entry.at("title").text, :summary => ((entry.at("summary") || entry.at_xpath("media:group").at_xpath("media:description")).text rescue nil), :description => ((entry.at("summary") || entry.at_xpath("media:group").at_xpath("media:description")).text rescue nil), :author => (entry.at("author name").text rescue nil), :playlist_id => (entry.at("id").text[/playlist:([\w\-]+)/, 1] rescue nil), :published => entry.at("published") ? entry.at("published").text : nil, :videos_count => (entry.at_xpath("openSearch:totalResults").text rescue nil), :response_code => content.status, :xml => content.body) end |