GithubHelp home page GithubHelp logo

qiuwei / youtube-upload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tokland/youtube-upload

4.0 1.0 1.0 145 KB

Upload videos to Youtube from the command line

Python 99.88% Batchfile 0.12%

youtube-upload's 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.

Dependencies

Check if your operating system provides those packages, otherwise install them with pip:

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

Install

$ wget https://github.com/tokland/youtube-upload/archive/master.zip
$ unzip master.zip
$ cd youtube-upload-master
$ sudo python setup.py install
  • Or run directly from sources:
$ cd youtube-upload-master
$ PYTHONPATH=. python bin/youtube-upload ...

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-upload --title="A.S. Mutter" anne_sophie_mutter.flv
pxzZ-fYjeYs
  • Upload a video with extra metadata, with your own client secrets and credentials file, and to a playlist (if not found, it will be created):
$ youtube-upload \
  --title="A.S. Mutter" 
  --description="A.S. Mutter plays Beethoven" \
  --category=Music \
  --tags="mutter, beethoven" \
  --recording-date="2011-03-10T15:32:17.0Z" \
  --default-language="en" \
  --default-audio-language="en" \
  --client-secrets=my_client_secrets.json \
  --credentials-file=my_credentials.json \
  --playlist "My favorite music" \
  anne_sophie_mutter.flv
tx2Zb-145Yz
  • Upload a video using a browser GUI to authenticate:
$ youtube-upload --title="A.S. Mutter" --auth-browser anne_sophie_mutter.flv
  • Split a video with ffmpeg

If your video is too big or too long for Youtube limits, split it before uploading:

$ bash examples/split_video_for_youtube.sh video.avi
video.part1.avi
video.part2.avi
video.part3.avi
  • 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-upload ....

Notes for developers

More

Feedback

  • Donations.
  • If you find a bug, open an issue.
  • If you want a new feature to be added, you'll have to send a pull request (or find a programmer to do it for you), currently I am not adding new features.

youtube-upload's People

Contributors

tokland avatar skylion007 avatar bene81 avatar sbma44 avatar djidiouf avatar lamby avatar davidventura avatar pigletto avatar darbychang avatar

Stargazers

Dmitriy Yakovlev avatar Michael Corrado avatar Eagle Gamma avatar megarom avatar

Watchers

Wei Qiu avatar

Forkers

gaybro8777

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.