Skip to content

olivierbloch/Scripts-for-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Upload Captions to YouTube video

This script allows to upload multiple captions files to a YouTube video. It uses the YouTube APIs (specifically the Captions Insert API) and requires a Google account that has Owner permissions on the channel.

Prerequisites

  1. Download the repo and extract it in a folder of your choice.

  2. Install Python from https://www.python.com/downloads

  3. Obtain Google OAuth Client ID: In order to run the script, you will need to obtain OAuth authorization credentials from the Google developer console. For this, you can follow the steps here. When following the steps at this link, after completing all steps including 3.5, select "Desktop app" as the application type, and name your app anything you want, then download the json file, place it next to the py script file (in the current folder) and rename it client_secret.json

Usage

  1. If that's the first time you are running the script or if your token has expired, delete the *token.json file.

  2. The script expects to have the following vtt files in a single folder (for example C:\Captions):

    • caption-en-us.vtt
    • caption-fr-fr.vtt
    • caption-de-de.vtt
    • caption-it-it.vtt
    • caption-ja-jp.vtt
    • caption-ko-kr.vtt
    • caption-pt-pt.vtt
    • caption-ru-ru.vtt
    • caption-es-es.vtt
    • caption-zh-cn.vtt

    If you are getting them from the Docs Video Portal, just download every single vtt file in a folder.

  3. Get your YouTube video ID from your YouTube video URL, extract the ID (see bold part in examples):

       https://www.youtube.com/watch?v=OzTagK628FM
       https://youtu.be/OzTagK628FM
    
  4. Run the script

    From the Terminal, make sure you are in the folder where the script file is, then type the following command (replacing the video ID and path to captions files with yours):

       python .\UploadCaptions.py OzTagK628FM "C:\Captions"
  5. Get your authorization code

    On the first run or after you have deleted the token.json file, you will be prompted to visit a URL and get an authorization code. For this, visit the URL displayed in your terminal:

    Visit URL prompt

    Select the brand account to get the credentials for:

    Select Brand account

    Click on Continue to discard warning message:

    Discard warning message

    Click on Allow to generate and access your code:

    Allow the app to access the google account

    Copy the Code:

    Copy the code

    Paste the code in your terminal and hit Enter

    Paste the code and continue the script

    From here, the script will proceed with the creation of the captions and upload of the files from the local folder

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages