Class: YouTubeIt::Parser::ProfileFeedParser
- Inherits:
-
FeedParser
- Object
- FeedParser
- YouTubeIt::Parser::ProfileFeedParser
- 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
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/youtube_it/parser.rb', line 104 def parse_content(content) xml = REXML::Document.new(content.body) entry = xml.elements["entry"] || xml.elements["feed"] YouTubeIt::Model::User.new( :age => entry.elements["yt:age"] ? entry.elements["yt:age"].text : nil, :username => entry.elements["yt:username"] ? entry.elements["yt:username"].text : nil, :company => entry.elements["yt:company"] ? entry.elements["yt:company"].text : nil, :gender => entry.elements["yt:gender"] ? entry.elements["yt:gender"].text : nil, :hobbies => entry.elements["yt:hobbies"] ? entry.elements["yt:hobbies"].text : nil, :hometown => entry.elements["yt:hometown"] ? entry.elements["yt:hometown"].text : nil, :location => entry.elements["yt:location"] ? entry.elements["yt:location"].text : nil, :last_login => entry.elements["yt:statistics"].attributes["lastWebAccess"], :join_date => entry.elements["published"] ? entry.elements["published"].text : nil, :movies => entry.elements["yt:movies"] ? entry.elements["yt:movies"].text : nil, :music => entry.elements["yt:music"] ? entry.elements["yt:music"].text : nil, :occupation => entry.elements["yt:occupation"] ? entry.elements["yt:occupation"].text : nil, :relationship => entry.elements["yt:relationship"] ? entry.elements["yt:relationship"].text : nil, :school => entry.elements["yt:school"] ? entry.elements["yt:school"].text : nil, :subscribers => entry.elements["yt:statistics"].attributes["subscriberCount"], :videos_watched => entry.elements["yt:statistics"].attributes["videoWatchCount"], :view_count => entry.elements["yt:statistics"].attributes["viewCount"], :upload_views => entry.elements["yt:statistics"].attributes["totalUploadViews"] ) end |