Class: YouTubeIt::Parser::BatchVideoFeedParser
- Inherits:
-
VideoFeedParser
- Object
- FeedParser
- VideoFeedParser
- YouTubeIt::Parser::BatchVideoFeedParser
- Defined in:
- lib/youtube_it/parser.rb
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
597 598 599 600 601 602 603 604 605 606 607 608 609 |
# File 'lib/youtube_it/parser.rb', line 597 def parse_content(content) Nokogiri::XML(content.body).xpath("//xmlns:entry").map do |entry| entry.namespaces.each {|name, url| entry.document.root.add_namespace name, url } username = entry.at_xpath('batch:id', entry.namespaces).text result = catch(:result) do case entry.at_xpath('batch:status', entry.namespaces)['code'].to_i when 200...300 then parse_entry(entry) else nil end end { username => result } end.reduce({},:merge) end |