extra-youtubeuploader

19.6.0 • Public • Published

Upload YouTube videos with caption through machines (via "youtubeuploader").

Do you want to:

Sample: "Pixelsphere OST (2017)".

setup

install

  1. Download for your OS from releases.
  2. Extract it to a directory and add the directory to PATH.

get client id

  1. Create an account on Google Cloud Platform.
  2. Create a new project, and select it.
  3. Enable YouTube Data API for the project.
  4. Add credentials to your project.
  5. Which API are you using? YouTube Data API v3.
  6. Where will you be calling the API from? Web server.
  7. What data will you be accessing? User data.
  8. Select What credentials do I need?.
  9. Create an OAuth 2.0 client ID.
  10. Name: youtubeuploader (your choice).
  11. Authorized JavaScript origins: http://localhost:8080.
  12. Authorized redirect URIs: http://localhost:8080/oauth2callback.
  13. Select Create OAuth client ID.
  14. Set up the OAuth 2.0 consent screen.
  15. Email address: (it should be correct).
  16. Product name shown to users: youtubeuploader (your choice).
  17. Select Continue.
  18. Download credentials.
  19. Select Download, then Done.
  20. Copy downloaded file (client_id.json) to a directory.

get client token

  1. Open console in the above directory.
  2. Run youtubeuploader -v client_id.json.
  3. OAuth page will be opened in browser.
  4. Choose an account, videos will be uploaded here.
  5. youtubeuploader wants to access your Google Account.
  6. Select Allow, and close browser window.
  7. client_token.json should be created.

set environment variables

  1. Copy path of client_id.json.
  2. Set environment variable YOUTUBEUPLOADER_CLIENT_ID to it.
  3. Copy path of client_token.json.
  4. Set environment variable YOUTUBEUPLOADER_CLIENT_TOKEN to it.
  5. Now you can use youtubeuploader from any directory.

On Windows, use RapidEE to set environment variable.

# on linux or macos console 
export YOUTUBEUPLOADER_CLIENT_ID="[PATH TO client_id.json]"
export YOUTUBEUPLOADER_CLIENT_TOKEN="[PATH TO client_token.json]"
 
# on windows powershell 
$env:YOUTUBEUPLOADER_CLIENT_ID="[PATH TO client_id.json]"
$env:YOUTUBEUPLOADER_CLIENT_TOKEN="[PATH TO client_token.json]"

console

youtubeuploader -v video.mp4
# video.mp4 uploaded (yay!) 
 
youtubeuploader -v video.mkv -ot "Me at the zoo" -od "The first video on YouTube..."
# video.mkv uploaded with title and description 
 
youtubeuploader -v video.mp4 -op public -l
# video.mp4 uploaded as public video (log enabled) 
 
youtubeuploader -ot "Me at the zoo"
# get video id from title 
 
youtubeuploader -i "jNQXAC9IVRw" -ot "Elephants at zoo"
# update video title "Me at the zoo" -> "Elephants at zoo" 
 
youtubeuploader -i "jNQXAC9IVRw" -c "odia.txt" -ol "or"
# upload odia captions for the video 

reference

youtubeuploader [options]
# --help:    show help 
# --version: show version 
# -l, --log:       enable log 
# -i, --id:        set video id (for update) 
# -v, --video:     set input video file/URL 
# -t, --thumbnail: set input thumbnail file/URL 
# -c, --caption:   set input caption file/URL 
# -m, --meta:      set input meta file 
# -d, --descriptionpath: set input description file 
# -ci, --client_id:      set client id credentials path (client_id.json) 
# -ct, --client_token:   set client token credentials path (client_token.json) 
# -ot, --title:         set title (video) 
# -od, --description:   set description (video) 
# -ok, --tags:          set tags/keywords 
# -ol, --language:      set language (en) 
# -oc, --category:      set category (people and blobd) 
# -op, --privacystatus: set privacy status (public) 
# -oe, --embeddable:    enable to be embeddable 
# -ol, --license:       set license (standard) 
# -os, --publicstatsviewable: enable public stats to be viewable 
# -opa, --publishat:          set publish time 
# -ord, --recordingdate:  set recording date 
# -opi, --playlistids:    set playlist ids 
# -opt, --playlisttitles: set playlist titles 
# -ola, --location_latitude:   set latitude coordinate 
# -olo, --location_longitude:  set longitude coordinate 
# -old, --locationdescription: set location description 
# -uc, --upload_chunk:  set upload chunk size in bytes (8388608) 
# -ur, --upload_rate:   set upload rate limit in kbps (no limit) 
# -ut, --upload_time:   set upload time limit ex- "10:00-14:00" 
# -ap, --auth_port:     set OAuth request port (8080) 
# -ah, --auth_headless: enable browserless OAuth process 
 
# Environment variables: 
$YOUTUBEUPLOADER_LOG # enable log (0) 
$YOUTUBEUPLOADER_VIDEO     # set input video file 
$YOUTUBEUPLOADER_THUMBNAIL # set input thumbnail file 
$YOUTUBEUPLOADER_CAPTION   # set input caption file 
$YOUTUBEUPLOADER_META      # set input meta file 
$YOUTUBEUPLOADER_DESCRIPTIONPATH # set input description file 
$YOUTUBEUPLOADER_CLIENT_ID       # set client id credentials path (client_id.json) 
$YOUTUBEUPLOADER_CLIENT_TOKEN    # set client token credentials path (client_token.json) 
$YOUTUBEUPLOADER_TITLE         # set title (file) 
$YOUTUBEUPLOADER_DESCRIPTION   # set description (file) 
$YOUTUBEUPLOADER_TAGS          # set tags/keywords 
$YOUTUBEUPLOADER_LANGUAGE      # set language (en) 
$YOUTUBEUPLOADER_CATEGORY      # set category id (22) 
$YOUTUBEUPLOADER_PRIVACYSTATUS # set privacy (public) 
$YOUTUBEUPLOADER_EMBEDDABLE    # enable to be embeddable (0) 
$YOUTUBEUPLOADER_LICENSE       # set license (standard) 
$YOUTUBEUPLOADER_PUBLICSTATSVIEWABLE # enable public stats to be viewable (0) 
$YOUTUBEUPLOADER_PUBLISHAT           # set publish time 
$YOUTUBEUPLOADER_RECORDINGDATE  # set recording date 
$YOUTUBEUPLOADER_PLAYLISTIDS    # set playlist ids 
$YOUTUBEUPLOADER_PLAYLISTTITLES # set playlist titles 
$YOUTUBEUPLOADER_LOCATION_LATITUDE   # set latitude coordinate 
$YOUTUBEUPLOADER_LOCATION_LONGITUDE  # set longitude coordinate 
$YOUTUBEUPLOADER_LOCATIONDESCRIPTION # set location description 
$YOUTUBEUPLOADER_UPLOAD_CHUNK  # set upload chunk size in bytes (8388608) 
$YOUTUBEUPLOADER_UPLOAD_RATE   # set upload rate limit in kbps (no limit) 
$YOUTUBEUPLOADER_UPLOAD_TIME   # set upload time limit ex- "10:00-14:00" 
$YOUTUBEUPLOADER_AUTH_PORT     # set OAuth request port (8080) 
$YOUTUBEUPLOADER_AUTH_HEADLESS # enable browserless OAuth process (0) 
// META file (.json)
// - specified using -m/--meta
// - all fields are optional
{
  "title": "How Risky Is The Stock Market?",
  "description": "Have you ever thought about investing ...",
  "tags": ["stock marketing", "risk management"],
  "privacyStatus": "public",
  "embeddable": true,
  "license": "creativeCommon",
  "publicStatsViewable": true,
  "publishAt": "2017-06-01T12:05:00+02:00",
  "categoryId": "10",
  "recordingdate": "2017-05-21",
  "location": {
    "latitude": 48.8584,
    "longitude": 2.2945
  },
  "locationDescription":  "Bombay Stock Exchange",
  "playlistIds":  ["xxxxxxxxxxxxxxxxxx", "yyyyyyyyyyyyyyyyyy"],
  "playlistTitles":  ["my test playlist"],
  "language":  "en"
}

package

const youtubeuploader = require('extra-youtubeuploader');
 
await youtubeuploader({video: 'video.mp4'})
// video.mp4 uploaded (yay!)
 
await youtubeuploader({video: 'video.mkv', title: 'Me at the zoo',
  description: 'The first video on YouTube...'});
// video.mkv uploaded with title and description
 
youtubeuploader({video: 'video.mp4', privacystatus: 'public', log: true});
// video.mp4 uploaded as public video (log enabled)
 
var ids = await youtubeuploader.lines({title: 'Me at the zoo'});
// get video ids from title
 
var id = ids[0];
await youtubeuploader({id, title: 'Elephants at zoo'});
// update video title "Me at the zoo" -> "Elephants at zoo"
 
await youtubeuploader({id, caption: 'odia.txt', language: 'or'});
// upload odia captions for the video

reference

const youtubeuploader = require('extra-youtubeuploader');
 
youtubeuploader.lines(options={})
// options: see below
// -> Promise <stdout lines>
 
youtubeuploader(options={})
// options: see below
// -> Promise {stdout, stderr}
 
// Default options:
options = {
  stdio: [0, 1, 2], // set child process stdio
  help: false,      // show help
  version: false,   // show version
  log: false,       // enable log
  id: '',        // set video id (for update)
  video: '',     // set input video file/URL
  thumbnail: '', // set input thumbnail file/URL
  caption: '',   // set input caption file/URL
  meta: '',      // set input meta file
  descriptionpath: '', // set input description file
  client: {
    id: 'client_id.json',       // set client id credentials path
    token: 'client_token.json'  // set client token credentials path
  },
  title: '<video>',             // set title
  description: '<video>',       // set description
  tags: '',                     // set tags/keywords
  language: 'en',               // set language
  category: 'people and blogs', // set category
  privacystatus: 'private',     // set privacy status
  embeddable: false,            // enable to be embeddable
  license: '',                  // set license (standard)
  publicstatsviewable: false,   // enable public stats to be viewable
  publishat: '',           // set publish time
  recordingdate: '',       // set recording date
  playlistids: '',         // set playlist ids
  playlisttitles: '',      // set playlist titles
  location: {
    latitude: '',          // set latitude coordinate
    longitude: '',         // set longitude coordinate
  },
  locationdescription: '', // set location description
  upload: {
    chunk: '',      // set upload chunk size in bytes (8388608)
    rate: '',       // set upload rate limit in kbps (no limit)
    time: ''        // set upload time limit ex- "10:00-14:00"
  },
  auth: {
    port: '8080',   // set OAuth request port
    headless: false // enable browserless OAuth process
  }
}

similar

Do you need anything similar?

Suggestions are welcome. Please create an issue.

nodef

Package Sidebar

Install

npm i extra-youtubeuploader

Weekly Downloads

6

Version

19.6.0

License

MIT

Unpacked Size

17.3 kB

Total Files

5

Last publish

Collaborators

  • wolfram77