Class: YouTubeIt::Parser::PlaylistFeedParser

Inherits:
FeedParser
  • Object
show all
Defined in:
lib/youtube_it/parser.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from FeedParser

#initialize, #parse, #parse_videos

Constructor Details

This class inherits a constructor from YouTubeIt::Parser::FeedParser

Instance Method Details

#parse_content(content) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/youtube_it/parser.rb', line 60

def parse_content(content)
  xml = REXML::Document.new(content.body)
  entry = xml.elements["entry"] || xml.elements["feed"]
  YouTubeIt::Model::Playlist.new(
    :title         => entry.elements["title"].text,
    :summary       => (entry.elements["summary"] || entry.elements["media:group"].elements["media:description"]).text,
    :description   => (entry.elements["summary"] || entry.elements["media:group"].elements["media:description"]).text,
    :playlist_id   => entry.elements["id"].text[/playlist([^<]+)/, 1].sub(':',''),
    :published     => entry.elements["published"] ? entry.elements["published"].text : nil,
    :response_code => content.status,
    :xml           => content.body)
end