Qnap [ YouTube Upload (CLI) ] [ 21.04 ] Scripted uploads to Youtube

QoolBox

Représentant QNAP
2 Janvier 2014
10 559
163
153
50
France
www.qnap.com
qpkg_icon_80.gif

Source https://github.com/porjo/youtubeuploader

Download

https://www.qnapclub.eu/fr/qpkg/1170


upload video files from local disk or from the web.
ratelimit upload bandwidth

youtubeuploader command added to NAS $PATH

Setup

Youtube API
Talking to the Youtube API requires oauth2 authentication. As such, you must:

Create an account on the Google Developers Console
Register a new app there
Enable the Youtube API (APIs & Services -> Enable APIs and Services)
Create Client ID (APIs & Auth -> Credentials -> Create Credentials), select 'Oauth client ID', select type 'Web application'
Add an 'Authorized redirect URI' of 'http://localhost:8080/oauth2callback'
Download the client secrets JSON file (click download icon next to newly created client ID) and save it as file client_secrets.json in the same directory as the utility e.g.

Code:
{
"web": {
"client_id": "xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
"project_id": "youtubeuploader-yyyyy",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "xxxxxxxxxxxxxxxxxxxx",
"redirect_uris": [
"http://localhost:8080/oauth2callback"
]
}
}

Usage

At a minimum, just specify a filename:

./youtubeuploader -filename blob.mp4
If it is the first time you've run the utility, a browser window should popup and prompt you to provide Youtube credentials. A token will be created and stored in request.token file in the local directory for subsequent use. To run the utility on a headless-server, generate the token file locally first, then simply copy the token file along with youtubeuploader and client_secrets.json to the remote host.

Full list of options:

Code:
-cache string
token cache file (default "request.token")
-caption string
caption filename. Can be a URL
-categoryId string
video category Id
-chunksize int
size (in bytes) of each upload chunk. A zero value will cause all data to be uploaded in a single request (default 16777216)
-description string
video description (default "uploaded by youtubeuploader")
-filename string
video filename. Can be a URL. Read from stdin with '-'
-headlessAuth
set this if no browser available for the oauth authorisation step
-language string
video language (default "en")
-limitBetween string
only rate limit between these times e.g. 10:00-14:00 (local time zone)
-metaJSON string
JSON file containing title,description,tags etc (optional)
-metaJSONout string
filename to write uploaded video metadata into (optional)
-notify
notify channel subscribers of new video (default true)
-oAuthPort int
TCP port to listen on when requesting an oAuth token (default 8080)
-privacy string
video privacy status (default "private")
-quiet
suppress progress indicator
-ratelimit int
rate limit upload in Kbps. No limit by default
-secrets string
Client Secrets configuration (default "client_secrets.json")
-tags string
comma separated list of video tags
-thumbnail string
thumbnail filename. Can be a URL
-title string
video title
-version
show version