0.05
No commit activity in last 3 years
No release in over 3 years
Search youtube via this simple ruby api
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Search youtube via this simple ruby api

  • simple
  • no dependencies

Install

gem install youtube_search

Usage

YoutubeSearch.search('boat').first
{
  "title"=>"Killer Whale Imitates Boat Motor",
  "published"=>"2011-09-29T15:30:43.000Z",
  "id"=>"http://gdata.youtube.com/feeds/api/videos/0b2U5r7Jwkc",
  "video_id"=>"0b2U5r7Jwkc",
  "content"=>"Top YouTube Videos on ...",
  "updated"=>"2011-10-13T20:20:54.000Z",
  "raw" => <REXML::Element ... >,
  "embeddable" => true,
  ...
}

or raw json with format: 'json'

page / per_page are supported

YoutubeSearch.search('cats', :page => 10, :per_page => 4).first

and standard youtube options

YoutubeSearch.search('cats', 'time' => 'this_week', 'orderby' => 'viewCount').first

I can haz iframe:

# DISCLAIMER this iframe may steal 4 minutes of your life ;)
id = YoutubeSearch.search('lolcats').first['video_id']
%{<iframe src="http://www.youtube.com/embed/#{id}" width=640 height=480 frameborder=0></iframe>}

Searching playlists

YoutubeSearch.search_playlists('cats').first

Retrieve videos by playlist ID

videos = YoutubeSearch.playlist_videos('5F23DAF4BFE3D14C')

TODO

  • more detailed xml parsing (you can fetch everything via 'raw', but more defaults would be nice)
  • parse dates into ruby objects

Author

Michael Grosser
michael@grosser.it
License: MIT Build Status