How to upload YouTube videos via a CLI

How to upload YouTube videos via a CLI

a computer screen with a program running on it

Ever found yourself bogged down by the repetitive task of uploading videos to YouTube through its web interface? Maybe it’s the time it takes, or perhaps you’re just a command-line aficionado who feels more at home with a terminal window than a web browser. Either way, you’re in luck! The youtubeuploader CLI tool is here to transform your YouTube video uploads into a breeze. In this comprehensive guide, we’ll walk you through everything from setting up the necessary YouTube API to the ins and outs of using youtubeuploader to make your video uploads as smooth as silk. Let’s get started!

Getting Started with youtubeuploader

Download the Tool

First things first, you need to get youtubeuploader onto your machine. If you’re looking to skip the build process, you can grab a precompiled binary suitable for Linux, Mac, or Windows directly from the GitHub releases page. Download the version compatible with your operating system and you’re good to go.

Setting Up the YouTube API

Before you can start uploading videos, you’ll need to do a little bit of setup with the YouTube API to ensure that youtubeuploader has the necessary permissions to act on your behalf.

  1. Create a Google Developer Account: Head over to the Google Developers Console and log in or create a new account if you haven’t already.
  2. Create a New Project: Click on Create Project and follow the prompts. This project will be used to manage your YouTube uploads.
  3. Enable the YouTube Data API v3: Navigate to APIs & Services -> Enable APIs and Services, then search for and enable the YouTube Data API v3.
  4. Set Up OAuth Consent Screen: Under APIs & Services, go to the OAuth Consent Screen tab and set it up. Make sure to add a test user, which should be the Google account associated with your YouTube channel.
  5. Create OAuth Client ID Credentials: Still in the APIs & Services section, go to Credentials and click CREATE CREDENTIALS, then select OAuth client ID. Choose Web application and set the authorized redirect URI to http://localhost:8080/oauth2callback.
  6. Download Client Secrets: After creating your OAuth client ID, download the client secrets file and save it as client_secrets.json in the same directory as youtubeuploader.

Note: For new projects, Google imposes certain restrictions, like automatically setting uploaded videos to private. To change this, you might need to verify your project with Google.

Usage Basics

Once you’ve got everything set up, using youtubeuploader is straightforward. At its simplest, uploading a video can be done with the following command:

Bash
./youtubeuploader -filename your_video.mp4

Advanced Options

youtubeuploader comes packed with options to customize your upload. Here are a few useful ones:

  • -title "Your Video Title": Sets the video title.
  • -description "Your video description": Sets the video description.
  • -tags "tag1,tag2": Sets video tags.
  • -privacy "public": Sets the video privacy status. Options include public, private, and unlisted.
  • -thumbnail "path/to/thumbnail.jpg": Sets the video thumbnail.

For a complete list of options, you can run ./youtubeuploader -help.

Handling Metadata

For more complex uploads, you can specify video metadata through a JSON file using the -metaJSON flag. This allows you to set properties like the video title, description, tags, privacy status, and more in a structured format. An example JSON could look like this:

JSON
{
  "title": "my test title",
  "description": "my test description",
  "tags": ["test tag1", "test tag2"],
  "privacyStatus": "private",
  "madeForKids": false,
  "embeddable": true,
  "license": "creativeCommon",
  "publicStatsViewable": true,
  "publishAt": "2017-06-01T12:05:00+02:00",
  "categoryId": "10",
  "recordingdate": "2017-05-21",
  "playlistIds":  ["xxxxxxxxxxxxxxxxxx", "yyyyyyyyyyyyyyyyyy"],
  "playlistTitles":  ["my test playlist"],
  "language":  "fr"
}

Final Thoughts

With youtubeuploader, the process of uploading videos to YouTube becomes a breeze, especially for those who love automation or prefer the command line over GUIs. Whether you’re a content creator looking to streamline your workflow or a developer integrating uploads into a larger system, this tool has got you covered.

Remember, with great power comes great responsibility. Make sure to follow YouTube’s guidelines and use this tool ethically. Happy uploading!

Share this content:

Leave a Reply

Your email address will not be published. Required fields are marked *