Skip to main content

Upload YouTube videos from Python and more.

Project description

PillarGG YouTube Uploader

Upload Youtube Videos and more via Python.

Getting Started

pip install pillar-youtube-upload

This project uses the Youtube Data API.

All implementations of youtube upload needs some form of authentication.

Client Side youtube upload

To upload youtube videos as a client, you need to follow this guide.

Server Side youtube upload

To upload youtube videos as a server, you need to follow this guide.

Getting a youtube api key

  1. First, you need to go to this website.
  2. If prompted, select a project, or create a new one.
  3. Use the Library page to find and enable the YouTube Data API v3.
  4. Go to the credentials page.
  5. Click Create Credentials > OAuth client ID.
  6. Select the Web application app type.
  7. Fill in the form and click create. For testing redirect URIs that refer to the local machine with http://localhost:8080.
  8. Download the client_secret.json file from the API Console and securely store the file in a location that only your application can access. By default, the application gets this file from the directory your script is being ran in. The path can also be changed when the class YouTubeUploader is being initialized.
  9. Get your client_id and client_secret.

We recommend that you design your app's auth endpoints so that your application does not expose authorization codes to other resources on the page.

The key must have the scope 'https://www.googleapis.com/auth/youtube.upload'.

Usage Info

This module uploads a given video to a youtube channel, as such there are 2 things this module needs.

  • A video

  • Video Options

    • Title
    • Description
    • Tags
    • Category
    • Status
    • DeclaredMadeForKids
  • A channel to upload to(In the form of a authentication file)

  • The authentication file should contain the following:

    • access_token: token_here
    • refresh_token: token_here
    • scope: scope_here
    • token_type: Bearer
    • expires_in: 3599

This file should be called client_secrets.sjon and exist in the directory this script is.

Usage

# youtube upload api
from youtube_upload.client import YouTubeUploader

uploader = YoutubeUploader(client_id,client_secret)
uploader.authenticate()

# Video options
options = {
    title : "Example title",
    description : "Example description",
    tags : ["tag1", "tag2", "tag3"],
    categoryId : "22",
    privacyStatus : "private",
    kids : False
    thumbnailLink : "https://cdn.havecamerawilltravel.com/photographer/files/2020/01/youtube-logo-new-1068x510.jpg"
}

# upload video
uploader.upload(file_path, options) 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pillar-youtube-upload-0.1.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

pillar_youtube_upload-0.1.1-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page