youtube-batch

Uploads all videos in the given folders to Youtube.


License
QPL-1.0
Install
pip install youtube-batch==0.2.0

Documentation

Introduction

youtube-batch is a command line Python script that uploads all videos (e.g.: batch upload) in given folders to Youtube (it should work on any platform -GNU/Linux, BSD, OS X, Windows, ...- that runs Python) using the Python script on GitHub tokland/youtube-upload with uses the Youtube APIv3.

Dependencies

Check if your operating system provides those packages and you dont want to use easy_install as shown the Install instructions below, otherwise install them with pip:

$ sudo pip install --upgrade google-api-python-client progressbar2

Install

First you have to install the Python script tokland/youtube-upload.

$ easy_install https://github.com/tokland/youtube-upload/archive/master.zip

Or install it manually

$ wget https://github.com/tokland/youtube-upload/archive/master.zip
$ unzip master.zip
$ cd youtube-upload-master
$ sudo python setup.py install

Then install youtube-batch

$ easy_install https://github.com/tkersten09/youtube-batch/archive/master.zip

Or manually as above

$ wget https://github.com/tkersten09/youtube-batch/archive/master.zip
$ unzip master.zip
$ cd youtube-batch-master
$ sudo python setup.py install

Authentication

You'll see that there is no email/password options. Instead, the Youtube API uses OAuth 2.0 to authenticate the upload. The first time you try to upload a video, you will be asked to follow a URL in your browser to get an authentication token. If you have multiple channels for the logged in user, you will also be asked to pick which one you want to upload the videos to. You can use multiple credentials, just use the option --credentials-file. Also, check the token expiration policies.

The package includes a default client_secrets.json file. If you plan to make a heavy use of the script, please create and use your own OAuth 2.0 file, it's a free service. Steps:

  • Go to the Google console.
  • Create project.
  • Side menu: APIs & auth -> APIs
  • Top menu: Enabled API(s): Enable all Youtube APIs.
  • Side menu: APIs & auth -> Credentials.
  • Create a Client ID: Add credentials -> OAuth 2.0 Client ID -> Other -> Name: youtube-upload -> Create -> OK
  • Download JSON: Under the section "OAuth 2.0 client IDs". Save the file to your local system.
  • Use this JSON as your credentials file: --client-secrets=CLIENT_SECRETS

Examples

  • Upload a video:
$ youtube-batch --endings="mpg, mp4" "D:\Dateien\upload1" "D:\Dateien\upload2"

Other extra medata available :

--privacy (public | unlisted | private)  
--publish-at (YYYY-MM-DDThh:mm:ss.sZ)  
--location (latitude=VAL,longitude=VAL[,altitude=VAL])  
--thumbnail (string)  
  • Upload a video using a browser GUI to authenticate:
$ youtube-upload --title="A.S. Mutter" --auth-browser anne_sophie_mutter.flv
  • Use a HTTP proxy

Set environment variables http_proxy and https_proxy:

$ export http_proxy=http://user:password@host:port
$ export https_proxy=$http_proxy
$ youtube-batch ....

Notes for developers

Alternatives

  • youtube-upload Its the basis of this script and its uploads videos to Youtube but can not batch-upload all videos in given folders.

  • shoogle can send requests to any Google API service, so it can be used not only to upload videos, but also to perform any operation regarding the Youtube API.

  • youtubeuploader uploads videos to Youtube from local disk or from the web. It also provides rate-limited uploads.

More