An open API service indexing awesome lists of open source software.

https://github.com/deanpcmad/youtuberb

Ruby library for the YouTube Data v3 API
https://github.com/deanpcmad/youtuberb

Last synced: about 2 months ago
JSON representation

Ruby library for the YouTube Data v3 API

Awesome Lists containing this project

README

        

# YouTubeRB

**This library is a work in progress**

YouTubeRB is a Ruby library for interacting with the YouTube Data v3 API.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'youtuberb'
```

## Usage

### Set Client Details

Firstly you'll need to set an API Key. A user Access Token is required to access private data.
An Access Token will be an OAuth2 token generated after authentication.

```ruby
# To access public data, just an API Key is required
@client = YouTube::Client.new(api_key: "")

# Or to access data for a user, an Access Token is also required
@client = YouTube::Client.new(api_key: "", access_token: "")
```

### Channels

```ruby
# Get the Channel details of the currently authenticated user
@client.channels.mine

# Get a Channel by ID
@client.channels.retrieve(id: "channel_id")

# Get a Channel by username
@client.channels.retrieve(username: "username")
```

### Videos

```ruby
# Get a single video
@client.videos.list(id: "abc123")
# => # # # #