Used for uploading large numbers of videos to YouTube
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
client_secrets.example.json
create_oauth_tokens.py
files.csv
requirements.txt
youtube.py
youtube.py-oauth2.example.json

README.md

YouTube Uploader

Introduction

This project was created based on code samples from YouTube's Python API documentation with adjustments made to enable mass uploads using a CSV metadata file.

This page in the YouTube API documentation was very helpful for creating this project.

Create OAuth tokens

First, you need to enable the YouTube API and setup a client_id and client_secret. To do this, follow the steps below.

  1. Go to the Google Cloud Console
  2. Create a new project by clicking Select a project in the header and then click NEW PROJECT. Note: If you already have a project, the Select a project button will be the name of the current project you are viewing.
  3. Add a name for the project (i.e. Python YouTube uploader)
  4. After the project is created, click Select a project and select the project you just created
  5. In the left sidebar click APIs & Services -> Dashboard
  6. Click ENABLE APIS AND SERVICES
  7. Enter YouTube in the search box and select YouTube Data API v3
  8. Click Enable
  9. Once the API is enabled, click Credentials in the left sidebar
  10. Click Create credentials and select the option OAuth client ID
  11. If a message appears about setting a product name for the consent screen follow these instructions.
    1. click Configure consent screen
    2. Enter a product name in the field labeled Product name shown to users (i.e. Python YouTube uploader)
    3. Click Save
  12. Select Other for the application type and name it what you would like (i.e. Python YouTube uploader)
  13. Copy the client ID and the client secret to use when running the create tokens command

Now that you have that, run the following command to create OAuth2 tokens.

python create_oauth_token.py

Running the upload script

To use, add the videos you would like to upload to files.csv. Then you can invoke the script using the code below.

python youtube.py

To specify the location of the csv input file.

python youtube.py ~/files-to-upload.csv