Code Monkey home page Code Monkey logo

youtube-video-upload's Introduction

youtube-video-upload

Upload videos starting from a yaml file.

Usage

To access the youtube api you will need the secrets downloaded from the google developers console, then you will be able to create the credentials to authorize your requests. For choosing where to store the newly created credentials put a path in secrets_path in the yaml file. To upload the video in tests/glitch.mp4 simply write a yaml file like this in tests/example.yaml:

videos:
    -
        title: testing this amazing script!
        file:  tests/video.mp4
        description: sdf
        category: Music
        privacy: private
        tags:
            - shit
            - holy

secrets_path: tests/client_secrets.json      # path for your google secrets
credentials_path:  path/to/credentials.json  # where to store credentials

Setup

Install dependencies, python-3.x is needed.

pip install youtube-video-upload

To use this script you need a client_secrets.json to put in secrets_path. To get this file:

  1. Create an account on the Google Developers Console
  2. Register a new app there
  3. Enable the Youtube API (APIs & Auth -> APIs)
  4. Create Client ID (APIs & Auth -> Credentials), select 'Other'
  5. Download the secrets file clicking on the download icon

Then you will be able to download a file with content similar to this:

{
  "installed": {
    "client_id": "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
    "client_secret": "xxxxxxxxxxxxxxxxxxxxx",
    "redirect_uris": ["http://localhost:8080/oauth2callback"],
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://accounts.google.com/o/oauth2/token"
  }
}

Store that file somewhere and update secrets_path.

Then execute:

pip install youtube-video-upload
python -m youtube_video_upload tests/example.yaml

If you run this script for the first time it will ask you to go to a url and copy paste a code to get the credentials. After that the script will store the credentials in credentials_path or default to ./credentials.json. Using credentials_path the credentials will be created there even if that path doesn't exist.

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.