Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
:video_camera: A Node.JS module, which provides an object oriented wrapper for the YouTube v3 API.
branch: master

Merge pull request #27 from kumavis/patch-1

Fix playlist insert call
latest commit 897fc9da28
Ionică Bizău authored
Failed to load latest commit information.
.gitignore add gitignore file
LICENSE Happy New Year! A little bit late. :-)
README.md Fix playlist insert call
index.js Deprecated setConfig method. JSDoc comments
package.json 0.3.2

README.md

Youtube API

A Node.JS module, which provides an object oriented wrapper for the Youtube v3 API.

NPM

Installation

Install with the Node.JS package manager npm:

$ npm install youtube-api

or

Install via git:

$ git clone git://github.com/IonicaBizau/youtube-api.git
$ cd youtube-api
$ npm install

Documentation

The official Youtube documentation is a very useful resource.

If you have any questions, just open an issue.

Example

var Youtube = require("youtube-api");

Youtube.authenticate({
    type: "oauth"
  , token: ACCESS_TOKEN
});

// List your channels
Youtube.channels.list({
    "part": "id"
  , "mySubscribers": true
  , "maxResults": 50
}, function (err, data) {
    console.log(err || data);
});

// Add a Video to a playlist
Youtube.playlistItems.insert({
    "part"  : "snippet"
  , "resource" : {
      "snippet" : {
        "playlistId" : "YouTube Playlist ID"
      , "resourceId" : {
          "kind" : "youtube#video"
        , "videoId" : "YouTube Video ID"
          }
        }
      }
});

Authentication

OAuth

Youtube.authenticate({
    type: "oauth"
  , token: "your access token"
});

Server Key

Youtube.authenticate({
    type: "key"
  , key: "your server key"
});

JWT

Youtube.authenticate({
    type: "jwt"
  , email: "77....3vv@developer.gserviceaccount.com"
  , keyFile: "... auth.pem"
  , key: "fb....d50"
  , subject: "you@gmail.com" // optional
  , scopes: ["https://www.googleapis.com/auth/youtube"]
}).authorize(function (err, data) {
    if (err) { throw err; }
    /* Access resources */
});

Running the Tests

Download and test this module using this test application.

Note that a connection to the internet is required to run the tests.

Contributors

See package.json file.

Donate

Help the youtube-api NPM package development. Any donation is welcome and I will be thankful!

LICENSE

MIT license. See the LICENSE file for details.

Changelog

v0.3.2

  • Insert request example in README.

v0.3.1

  • Fixes in documentation

v0.3.0

  • JWT authentication type
  • All request types are supported (using googleapis)
  • Deprecacted setConfig method

v0.2.2

  • Removed debugging message from index.js
  • Output an error in application logs if there is an unkwnown error in request
  • Minor fix in util.js

v0.2.1

v0.2.0

  • Added the key authentication.

    Example:

    Youtube.authenticate({
        type: 'key'
      , key: 'AIz...OtE'
    });

v0.1.1

  • Fixed #2 (pull request): fix in videos API requests.

v0.1.0

  • Initial release
  • Supports only GET requests
Something went wrong with that request. Please try again.