extra-youtubeuploader
v19.6.0
Published
Upload YouTube videos with caption through machines (via "youtubeuploader").
Downloads
20
Maintainers
Readme
Upload YouTube videos with caption through machines (via "youtubeuploader").
Do you want to:
- Upload your AI generated video to YouTube?
- Or, Upload Wikipedia TTS videos on YouTube?
Sample: "Pixelsphere OST (2017)".
setup
install
- Download for your OS from releases.
- Extract it to a directory and add the directory to
PATH
.
get client id
- Create an account on Google Cloud Platform.
- Create a new project, and select it.
- Enable YouTube Data API for the project.
- Add credentials to your project.
- Which API are you using?
YouTube Data API v3
. - Where will you be calling the API from?
Web server
. - What data will you be accessing?
User data
. - Select
What credentials do I need?
. - Create an OAuth 2.0 client ID.
- Name:
youtubeuploader
(your choice). - Authorized JavaScript origins:
http://localhost:8080
. - Authorized redirect URIs:
http://localhost:8080/oauth2callback
. - Select
Create OAuth client ID
. - Set up the OAuth 2.0 consent screen.
- Email address: (it should be correct).
- Product name shown to users:
youtubeuploader
(your choice). - Select
Continue
. - Download credentials.
- Select
Download
, thenDone
. - Copy downloaded file (
client_id.json
) to a directory.
get client token
- Open console in the above directory.
- Run
youtubeuploader -v client_id.json
. - OAuth page will be opened in browser.
- Choose an account, videos will be uploaded here.
youtubeuploader
wants to access your Google Account.- Select
Allow
, and close browser window. client_token.json
should be created.
set environment variables
- Copy path of
client_id.json
. - Set environment variable
YOUTUBEUPLOADER_CLIENT_ID
to it. - Copy path of
client_token.json
. - Set environment variable
YOUTUBEUPLOADER_CLIENT_TOKEN
to it. - 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?
- extra-stillvideo can generate video from audio and image.
- extra-googletts can generate spoken audio from text.
Suggestions are welcome. Please create an issue.