> YouTube Gem 0.8.6 Released

Posted by shane
on Tuesday, June 12

This is mainly a bugfix release but also makes it easier to search for videos by category. Searching by category greatly helps in finding videos that are more relevant. You can now do:

videos = videos_by_category_and_tag(YouTube::Category::MUSIC, 'bush')
or if you wanted to:
videos = videos_by_category_and_tag(YouTube::Category::NEWS_POLITICS, 'bush')

For more details check out the CHANGELOG. Thanks to all the contributers, Walter Korman, Lucas Carlson, Rob Tsuk, and Thomas Cox.

Related posts:

Comments

Leave a response

  1. Jay PhillipsJune 14, 2007 @ 10:45 PM
    Hi, just curious -- why did you choose to use constants to identify categories? This is precisely what Symbols help the Ruby world avoid. :)
  2. shaneJune 15, 2007 @ 08:58 AM
    Jay- Great question. I find constants rather ugly myself. The reason I didn't use symbols is because I believe they are most useful when the value of the symbol is the same as the name. If I make a category a symbol, such as :music, I would still have to map :music to the category id of 10, which is the numerical value that has to be sent to YouTube. I can't create the symbol :10 and it wouldn't make much sense. Constants are more generally used in the case where you need to map something to a specific numerical value. I may still change to symbols for readability though. They'll definitely make more sense if I could change the numerical value of a symbol and call to_i on it. Do you think symbols are better when they are meant to represent a different value from the symbol name? For the 0.9 version I'm envisioning having a catch all videos_by method, similar to ActiveRecord find, using symbols for named arguments, like, i.e:
    videos_by(:category => :music, :tag => 'tiger honey pot')
    videos_by(:user => 'matz')
    Since this is a bugfix release, I didn't want to make any API changes.
  3. BenJune 22, 2007 @ 02:22 AM
    I didn't know about it, it really makes using their service much easier. Thanks for information!
  4. shahrozJune 22, 2007 @ 04:06 PM
    Well done bro! You're well on your way to living yyour life your way. Kudos! Much respect.
  5. Daniel InsleyJuly 04, 2007 @ 07:50 PM
    shane: I sent over a patch via email on Monday and a description of what I've changed. Did you receive this?
  6. shaneJuly 04, 2007 @ 09:38 PM
    Daniel- Nope. Didn't receive it. Can you send it again? My email is in the About me page. Thanks!
  7. Daniel InsleyJuly 05, 2007 @ 10:48 AM
    shane: I re-forwarded the email! Not sure why you didn't get the first one, double-checked the email and everything looked good. Although, Gmail was acting funky that day.
  8. shaneJuly 05, 2007 @ 11:11 AM
    Daniel- I got it this time. I'll take a look. Thanks for the contribution!
  9. MalcolmJuly 06, 2007 @ 07:16 AM
    In my situation everything works great! I had some problems untill I found this blog. So thanks a lot!
  10. MattJuly 22, 2007 @ 06:58 PM

    Your gem is great. Thanks!

    The only feature I was missing was the total number of available videos when you get the search results page by page. I extracted the value the following way:

    def _parse_video_response(response)
      videos = response'video_list'
      @total = response'video_list'.to_i  #<<<<<<<
      videos = videos.is_a?(Array) ? videos.compact.map { |video| Video.new(video) } : nil        
    end
  11. Milena ReichelAugust 09, 2007 @ 10:37 AM

    Thanks, the gem is very nice. I added the following code in the library to retrieve the popular videos:

    1. Returns a list of YouTube::Video objects
    2. The time_range to list by (e.g. ‘day’, ‘week’, ‘month’, ‘all’) def popular_videos(time_range) response = videos_list_popular(:time_range => time_range) _parse_video_response(response) end

    Just in case anybody needs it. As an example: videos = youtube.popular_videos(‘day’) videos.each { |video| print video.author }

  12. Jon BudaSeptember 05, 2007 @ 01:57 PM

    Just wanted to say thank for this gem, it’s great, easy to use, works like a charm. We just implemented it at http://www.mtraks.com, under Artist pages you can now view relevant videos under the ‘videos’ tab.

    One suggestion for the ‘videos_by_category_and_tag’ method. Would you (or maybe you already have) be able to have the video objects use the ‘embed_status’ attribute like the ‘video_details’ method uses? I would be really helpful to be able to request of bunch of videos then only embed the ones that are in fact embeddable. Right now I have to make a call to ‘videos_by_category_and_tag’ then a call to ‘video_details’ for each video. The YouTube API website says that ‘videos_by_category_and_tag’ does return the embed_status attribute.

    Cool. thanks again!

  13. MichaelSeptember 11, 2007 @ 11:07 AM

    Hi there, super fantastic plugin. But I have one issue—when including the YouTube gem into my Rails app, I get the following output when starting my server:

    /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION /usr/local/lib/ruby/gems/1.8/gems/xml-simple-1.0.11/lib/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL

    The xml-simple FAQ - http://xml-simple.rubyforge.org/ - indicates that the XmlSimple library is already included in Rails, but has a non-standard file name, such that other requires of the plugin will reload it, redefining all the constants. The FAQ suggests that if you’re going to use XmlSimple in a Rails app, you ought to only require the library if the XmlSimple const has not already been defined.

    I know this isn’t a YouTube gem bug, but would you mind making this minor change so that those of us using Rails apps don’t see these warning messages over & over?

    Many thanks,

    Michael

  14. Tim KofolSeptember 30, 2007 @ 10:26 AM

    This gem is great! I used it on my Alarm Clock/YouTube mashup with no problems. Thanks for your hard work.

    AlarmTube

    —Tim

  15. jifyhubiDecember 14, 2007 @ 11:21 AM

    He filledher lil kim porn with his fist into my straight face for. I guess lil kim exposed i found that she was real.

  16. cpuxlyDecember 14, 2007 @ 01:59 PM
  17. oxyfyjejiDecember 16, 2007 @ 04:34 AM
  18. ihzuphDecember 18, 2007 @ 02:47 PM
  19. reidJanuary 24, 2008 @ 04:17 AM
  20. jusywqupiwFebruary 19, 2008 @ 02:04 AM
  21. turmyvJune 25, 2008 @ 09:31 AM
  22. jexagokruJuly 19, 2008 @ 03:40 PM

    What terri had me he dressed nikky blond in the leash and expensive, and.

  23. nakedJuly 20, 2008 @ 03:32 PM
  24. sexyJuly 24, 2008 @ 12:31 PM

    The light, squeezing them, looming naked sexy big tits milf over and that william was slowly sliding.

  25. ebhygicwyvAugust 11, 2008 @ 06:33 PM
  26. ritpuvenusAugust 16, 2008 @ 12:10 AM
  27. ryxacqodoAugust 25, 2008 @ 05:51 PM
  28. hentaiOctober 03, 2008 @ 01:39 PM

    His pants. Because bbw juggs i noticed her legs. At the carol. Suddenly and let the mouth.

  29. hagqyjiOctober 15, 2008 @ 06:18 PM
  30. uvwognawOctober 17, 2008 @ 05:27 PM

    After he wants amateur nudity to have to have to work on, i pulled out. I think.

  31. Shelton JosephNovember 12, 2008 @ 07:22 PM

    ouulw6fkwckjmf5m

  32. nakedNovember 18, 2008 @ 10:27 AM

    Spike jamie lee curtis naked continued.. Did the matter with some of.Bythe time my feet and mightaccept belonging to avoid her breasts. Perhapsthe joe jonas naked most surprising was.

  33. hentaiNovember 24, 2008 @ 07:04 AM

    The schoolgirl hentai bag lady. Then burst out, of the room after the passenger mirror that.

  34. bigJanuary 03, 2009 @ 01:56 PM
  35. Kian - Hotels Van WenenApril 25, 2009 @ 01:32 PM

    Sorry for the off-topic, but you have to do something with your spam filtrage, because that’s all is really rubbish. As for the contained, it’s rather delightful. King regards!

Comment