youtube-api

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

youtube-api

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

$ npm i youtube-api

You may be interested to download this test application and play with the YouTube API resources there. Below you see an example how to use the library.

// Dependencies 
var Youtube = require("youtube-api");
 
// Authenticate using an access token 
Youtube.authenticate({
    type: "oauth"
  , token: "your access token"
});
 
// List your subcribers 
Youtube.subscriptions.list({
    "part": "id"
  , "mySubscribers": true
  , "maxResults": 50
}, function (errdata) {
    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"
            }
        }
    }
}, function (errdata) {
    console.log(err || data);
});
 

The official Youtube documentation is a very useful resource.

If you have any questions, just open an issue.

Youtube.authenticate({
    type: "oauth"
  , token: "your access token"
});
Youtube.authenticate({
    type: "oauth"
  , refresh_token: "your refresh token"
  , client_id: "your client id"
  , client_secret: "your client secret"
  , redirect_url: "your refresh url"
});
Youtube.authenticate({
    type: "key"
  , key: "your server key"
});

Just perfect for server side only authentication. It does not require client side interaction.

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 (errdata) {
    if (err) { throw err; }
    /* Access resources */
});

Have an idea? Found a bug? See how to contribute.

KINDLY © Ionică Bizău–The LICENSE file contains a copy of the license.