Giter Club home page Giter Club logo

youtube_search's Introduction

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
[email protected]
License: MIT Build Status

youtube_search's People

Contributors

aantix avatar dgilperez avatar effektz avatar grosser avatar sbogutyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube_search's Issues

Api work broken

Youtube move API to v3. So gem not work.

YoutubeSearch.search('lolcats').first['video_id']
OpenURI::HTTPError: 410 Gone

Obtaining all results for a term

Hi, is there a way to obtain all results for a term? The results seem limited.

Eg: YoutubeSearch.search('cat', 'time' => 'all_time', 'orderby' => 'viewCount', :page => 26, :per_page => 4)

This returns about 100 results (26 pages) divided into pages. Is there a way to get all the results available? Thanks.

-Thomas

Obtaining a playlist

Hi grosser,

I was wondering if I could use your gem to fetch videos from a certain user and playlist.

Reading the Youtube API docs here http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Playlists I can see this is posible through the API. The URL for retrieving videos from a playlist looks like

https://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2

Would it be posible with youtube_searchor should I write it myself? Would you be interested in such a pull request if so?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.