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.

youtube-video-upload's People

Contributors

remorses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

youtube-video-upload's Issues

Possible to upload all files of a said extension?

Hello! First of all, i don't code so it took me forever to understand how it was working but i felt proud when i did! Now all i'd like to know is how i can make it so every .mkv files in my folder are scanned then uploaded to youtube. I tried various things like *mkv or *.mkv but yaml slap me with the "invalid argument." Would you know by any chances how i can incorporate that in your script?

There is no "other" option in Google Cloud Platform

There is no "other" option.

I tried others:

Web Application -> "you have to choose other and not web application in google cloud console" in CLI and "Error 400: redirect_uri_mismatch" in browser

TV and Limited Input -> no error in CLI, but "Error 400: invalid_request Localhost URI is not allowed for 'NATIVE_DEVICE' client type."

Desktop -> no error in CLI, i get a login page. I log in with a registered test user (same youtube account). "Google hasn’t verified this app" -> Continue. " wants access to your Google Account" -> Continue. Goes to "http://localhost:8080/..." with error "Site unreachable" (logically) and no credentials created.

Am I doing someting wrong or am I just wasting my time?

Private (Locked) - Terms and policies: This video has been made private by YouTube

So the video's upload just fine, but apparently they violate terms and policies for "spam or desceptive content", wich it is not.

I can upoad the vid as private and it is fine:
2022-03-19 09_39_06-Channel content - YouTube Studio

As soon as I make the video public or unlisted it is irreversibly flagged.
2022-03-19 09_40_00-Channel content - YouTube Studio

Uploading the same video manually with same tags, description etc. is not a problem.
2022-03-19 09_47_41-Channel content - YouTube Studio

The only difference i see is that when uploading manually you have to select if is content aimed at children or not
2022-03-19 09_48_11-Channel content - YouTube Studio
Maybe this is causing a problem?

There is no way to appeal the violation.

Setting playlist

I don't see any reference to setting the playlist in the example yaml, but is this possible?

yaml loading

When I try to execute the example code I get an error:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\youtube_video_upload\__main__.py", line 11, in <module>
    options = yaml.load(yaml_file.read())
TypeError: load() missing 1 required positional argument: 'Loader'

Then, I changed line 11 of main to:
options = yaml.safe_load(yaml_file.read())

And it works

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.