kylejginavan / youtube_it

An object-oriented Ruby wrapper for the YouTube GData API
http://groups.google.com/group/ruby-youtube-library
595 stars 223 forks source link

parse_activity_videos is broken #77

Closed rainchen closed 12 years ago

rainchen commented 12 years ago

When I tried

youtube_client.activity(user_id)

it will raise an error "NoMethodError Exception: undefined method `elements' for nil:NilClass"

the bug is here:

 https://github.com/kylejginavan/youtube_it/blob/master/lib/youtube_it/parser.rb#L218

the value of link_tag would be (when video_type is "video_rated"):

 "<link href='http://gdata.youtube.com/feeds/api/videos/videoid' rel='http://gdata.youtube.com/schemas/2007#video' type='application/atom+xml'/>"

then

YouTubeIt::Parser::VideoFeedParser.new(link_tag).parse

will be exceptional

here is a quick fix:

videos << YouTubeIt::Parser::VideoFeedParser.new(link_tag).parse if link_tag.elements["entry"]

gem version : 2.1.4

chebyte commented 12 years ago

thanks for this report, I added the fix