|
@@ -1,7 +1,7 @@
|
|
Introduction
|
|
Introduction
|
|
============
|
|
============
|
|
|
|
|
|
-_Youtube-upload_ is a command line Python script that uploads videos to Youtube (it should work on any platform -GNU/Linux, BSD, OS X, Windows, ...- that runs Python) using theYoutube [APIv3](https://developers.google.com/youtube/v3/).
|
|
|
|
|
|
+Command-line script to upload videos to Youtube using theYoutube [APIv3](https://developers.google.com/youtube/v3/). It should work on any platform (GNU/Linux, BSD, OS X, Windows, ...) that runs Python.
|
|
|
|
|
|
Dependencies
|
|
Dependencies
|
|
============
|
|
============
|
|
@@ -12,7 +12,7 @@ Dependencies
|
|
Check if your operating system provides those packages (check also those [deb/rpm/mac files](https://github.com/qiuwei/youtube-upload/releases)), otherwise install them with `pip`:
|
|
Check if your operating system provides those packages (check also those [deb/rpm/mac files](https://github.com/qiuwei/youtube-upload/releases)), otherwise install them with `pip`:
|
|
|
|
|
|
```
|
|
```
|
|
-$ sudo pip install --upgrade google-api-python-client progressbar2
|
|
|
|
|
|
+$ sudo pip install --upgrade google-api-python-client oauth2client progressbar2
|
|
```
|
|
```
|
|
|
|
|
|
Install
|
|
Install
|
|
@@ -25,19 +25,19 @@ $ cd youtube-upload-master
|
|
$ sudo python setup.py install
|
|
$ sudo python setup.py install
|
|
```
|
|
```
|
|
|
|
|
|
- * Or run directly from sources:
|
|
|
|
|
|
+Or run directly from sources:
|
|
|
|
|
|
```
|
|
```
|
|
$ cd youtube-upload-master
|
|
$ cd youtube-upload-master
|
|
$ PYTHONPATH=. python bin/youtube-upload ...
|
|
$ PYTHONPATH=. python bin/youtube-upload ...
|
|
```
|
|
```
|
|
|
|
|
|
-Authentication
|
|
|
|
-==============
|
|
|
|
|
|
+Setup
|
|
|
|
+=====
|
|
|
|
|
|
You'll see that there is no email/password options. Instead, the Youtube API uses [OAuth 2.0](https://developers.google.com/accounts/docs/OAuth2) 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](https://developers.google.com/youtube/v3/) policies.
|
|
You'll see that there is no email/password options. Instead, the Youtube API uses [OAuth 2.0](https://developers.google.com/accounts/docs/OAuth2) 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](https://developers.google.com/youtube/v3/) 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](https://developers.google.com/youtube/registering_an_application), it's a free service. Steps:
|
|
|
|
|
|
+The package used to include a default ```client_secrets.json``` file. It does not work anymore, Google has revoked it. So you now must [create and use your own OAuth 2.0 file](https://developers.google.com/youtube/registering_an_application), it's a free service. Steps:
|
|
|
|
|
|
* Go to the Google [console](https://console.developers.google.com/).
|
|
* Go to the Google [console](https://console.developers.google.com/).
|
|
* _Create project_.
|
|
* _Create project_.
|
|
@@ -46,12 +46,14 @@ The package includes a default ```client_secrets.json``` file. If you plan to ma
|
|
* Side menu: _APIs & auth_ -> _Credentials_.
|
|
* Side menu: _APIs & auth_ -> _Credentials_.
|
|
* _Create a Client ID_: Add credentials -> OAuth 2.0 Client ID -> Other -> Name: youtube-upload -> Create -> OK
|
|
* _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.
|
|
* _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```
|
|
|
|
|
|
+* Use this JSON as your credentials file: `--client-secrets=CLIENT_SECRETS` or copy it to `~/client_secrets.json`.
|
|
|
|
+
|
|
|
|
+*Note: ```client_secrets.json``` is a file you can download from the developer console, the credentials file is something auto generated after the first time the script is run and the google account sign in is followed, the file is stored at ```~/.youtube-upload-credentials.json```.*
|
|
|
|
|
|
Examples
|
|
Examples
|
|
========
|
|
========
|
|
|
|
|
|
-* Upload a video:
|
|
|
|
|
|
+* Upload a video (a valid `~/.client_secrets.json` should exist, check the Setup section):
|
|
|
|
|
|
```
|
|
```
|
|
$ youtube-upload --title="A.S. Mutter" anne_sophie_mutter.flv
|
|
$ youtube-upload --title="A.S. Mutter" anne_sophie_mutter.flv
|
|
@@ -62,16 +64,16 @@ pxzZ-fYjeYs
|
|
|
|
|
|
```
|
|
```
|
|
$ youtube-upload \
|
|
$ youtube-upload \
|
|
- --title="A.S. Mutter"
|
|
|
|
|
|
+ --title="A.S. Mutter" " \
|
|
--description="A.S. Mutter plays Beethoven" \
|
|
--description="A.S. Mutter plays Beethoven" \
|
|
- --category=Music \
|
|
|
|
|
|
+ --category="Music" \
|
|
--tags="mutter, beethoven" \
|
|
--tags="mutter, beethoven" \
|
|
--recording-date="2011-03-10T15:32:17.0Z" \
|
|
--recording-date="2011-03-10T15:32:17.0Z" \
|
|
--default-language="en" \
|
|
--default-language="en" \
|
|
--default-audio-language="en" \
|
|
--default-audio-language="en" \
|
|
- --client-secrets=my_client_secrets.json \
|
|
|
|
- --credentials-file=my_credentials.json \
|
|
|
|
- --playlist "My favorite music" \
|
|
|
|
|
|
+ --client-secrets="my_client_secrets.json" \
|
|
|
|
+ --credentials-file="my_credentials.json" \
|
|
|
|
+ --playlist="My favorite music" \
|
|
--embeddable=True|False \
|
|
--embeddable=True|False \
|
|
anne_sophie_mutter.flv
|
|
anne_sophie_mutter.flv
|
|
tx2Zb-145Yz
|
|
tx2Zb-145Yz
|
|
@@ -122,7 +124,7 @@ Get available categories
|
|
|
|
|
|
And see the JSON response below. Note that categories with the attribute `assignable` equal to `false` cannot be used.
|
|
And see the JSON response below. Note that categories with the attribute `assignable` equal to `false` cannot be used.
|
|
|
|
|
|
-Using `shoogle`:
|
|
|
|
|
|
+Using [shoogle](https://github.com/tokland/shoogle):
|
|
|
|
|
|
```
|
|
```
|
|
$ shoogle execute --client-secret-file client_secret.json \
|
|
$ shoogle execute --client-secret-file client_secret.json \
|