youtube-uploader

Youtube video uploader library for Node.js

npm install youtube-uploader
6 downloads in the last month

Youtube Uploader

NPM NPM

youtube-uploader is a Youtube video uploader library written in Node.js.

This library wraps Google's sample code written in Python: upload_video.py. OAuth2 configuration files (client_secrets.json and upload_video.py-oauth2.json) are required by the python script and they can be conveniently generated by calling configure() before upload().

Dependencies

  • python: Python must be installed and should be executable by python command.

Installation

$ npm install youtube-uploader

Usage

var youtubeUploader = require('youtube-uploader');

youtubeUploader.configure({
  accessToken: ACCESS_TOKEN,  // string
  clientId: CLIENT_ID,  // string
  clientSecret: CLIENT_SECRET,  // string
  expiresIn: EXPIRES_IN,  // string (default: '3600')
  idToken: ID_TOKEN,  // string
  refreshToken: REFRESH_TOKEN,  // string
  tokenType: TOKEN_TYPE  // string (default: 'Bearer')
}, function (err) {
  if (err) { return console.error(err.message); }
  youtubeUploader.upload({
    path: VIDEO_PATH,  // string
    title: TITLE,  // string
    description: DESCRIPTION,  // string
    keywords: KEYWORDS,  // array of string
    category: CATEGORY_ID,  // string (refer to https://developers.google.com/youtube/v3/docs/videoCategories/list)
    privacy: PRIVACY  // 'public', 'private', or 'unlisted'
  }, function (err, videoId) {
    // ...
  });
});

Credits

See the contributors.

License

youtube-uploader is released under the MIT License.

npm loves you