did you check the Youtube API on google developers guide, check the Video Upload section? you will find something like this:

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("My Test Movie");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("cars");
mg.getKeywords().addKeyword("funny");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));

newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0));
// alternatively, one could specify just a descriptive string
// newEntry.setLocation("Mountain View, CA");

MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime");
newEntry.setMediaSource(ms);

String uploadUrl =
  "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);

Probably you will the successfully authenticate before you can upload teh video like:

YouTubeService service = new YouTubeService(clientID, developer_key);

Hope this helps

Answer from CloudyMarble on Stack Overflow
🌐
GitHub
github.com › youtube › api-samples › blob › master › java › src › main › java › com › google › api › services › samples › youtube › cmdline › data › UploadVideo.java
api-samples/java/src/main/java/com/google/api/services/samples/youtube/cmdline/data/UploadVideo.java at master · youtube/api-samples
import com.google.api.services.youtube.model.VideoStatus; import com.google.common.collect.Lists; · import java.io.IOException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; · /** * Upload a video to the authenticated user's channel.
Author: youtube
🌐
GitHub
github.com › soumik-dutta › youtube-upload-javaAPI
GitHub - soumik-dutta/youtube-upload-javaAPI: Upload videos with youtube-java API · GitHub
September 27, 2016 - 1.Create an url that will ask the user to give access to the app . 2.After successful authentication a code will be received (An instance of jetty server continuously listens untill the code is received ). 3.Exchange the code just received with ...
Author: soumik-dutta
🌐
Java Tips
javatips.net › api › com.google.api.services.youtube.model.video
Java Examples for com.google.api.services.youtube.model.Video
The following java examples will help you to understand the usage of com.google.api.services.youtube.model.Video. These source code samples are taken from different open source projects. ... public static Video upload(String url, String playListToken, List<String> tags) { Video uploadedVideo; try { VideoSnippet snippet = new VideoSnippet(); Calendar cal = Calendar.getInstance(); snippet.setTitle("FI-WARE project.
Top answer
1 of 2
5

did you check the Youtube API on google developers guide, check the Video Upload section? you will find something like this:

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("My Test Movie");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("cars");
mg.getKeywords().addKeyword("funny");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));

newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0));
// alternatively, one could specify just a descriptive string
// newEntry.setLocation("Mountain View, CA");

MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime");
newEntry.setMediaSource(ms);

String uploadUrl =
  "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);

Probably you will the successfully authenticate before you can upload teh video like:

YouTubeService service = new YouTubeService(clientID, developer_key);

Hope this helps

2 of 2
1

You have to create a new VideoEntry object

The following code uploads the video:

VideoEntry newEntry = new VideoEntry();

YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
mg.setTitle(new MediaTitle());
mg.getTitle().setPlainTextContent("Title goes here");
mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
mg.setKeywords(new MediaKeywords());
mg.getKeywords().addKeyword("keyword-here");
mg.setDescription(new MediaDescription());
mg.getDescription().setPlainTextContent("My description");
mg.setPrivate(false);
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "mydevtag"));
mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "anotherdevtag"));

newEntry.setGeoCoordinates(new GeoRssWhere(37.0,-122.0));
// alternatively, one could specify just a descriptive string
// newEntry.setLocation("Mountain View, CA");

MediaFileSource ms = new MediaFileSource(new File("file.mov"), "video/quicktime");
newEntry.setMediaSource(ms);

String uploadUrl =
"http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";

VideoEntry createdEntry = service.insert(new URL(uploadUrl), newEntry);

See https://developers.google.com/youtube/2.0/developers_guide_java#Uploading_Videos

🌐
GitHub
github.com › youtube › api-samples › tree › master › java
api-samples/java at master · youtube/api-samples
Method: youtube.videos.insert Description: This sample calls the API's videos.insert method to upload a video to the channel associated with the request.
Top answer
1 of 1
1

This shows how to upload a video using an HTTP request.

There are code snippets that are also available in java (and kotlin is pretty similar).

In order to see how to upload a video, go to https://developers.google.com/youtube/v3/code_samples/code_snippets, select Videos under Resource and insert under method.

If you then click on Show code and select JAVA at the top, you will get this example code:

/**
 * Sample Java code for youtube.videos.insert
 * See instructions for running these code samples locally:
 * https://developers.google.com/explorer-help/guides/code_samples#java
 */

import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
import com.google.api.client.http.InputStreamContent;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;

import com.google.api.services.youtube.YouTube;
import com.google.api.services.youtube.model.Video;
import com.google.api.services.youtube.model.VideoSnippet;
import com.google.api.services.youtube.model.VideoStatus;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.Collection;

public class ApiExample {
    // You need to set this value for your code to compile.
    // For example: ... DEVELOPER_KEY = "YOUR ACTUAL KEY";
    private static final String DEVELOPER_KEY = "YOUR_API_KEY";

    private static final String APPLICATION_NAME = "API code samples";
    private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();

    /**
     * Build and return an authorized API client service.
     *
     * @return an authorized API client service
     * @throws GeneralSecurityException, IOException
     */
    public static YouTube getService() throws GeneralSecurityException, IOException {
        final NetHttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
        return new YouTube.Builder(httpTransport, JSON_FACTORY, null)
            .setApplicationName(APPLICATION_NAME)
            .build();
    }

    /**
     * Call function to create API service object. Define and
     * execute API request. Print API response.
     *
     * @throws GeneralSecurityException, IOException, GoogleJsonResponseException
     */
    public static void main(String[] args)
        throws GeneralSecurityException, IOException, GoogleJsonResponseException {
        YouTube youtubeService = getService();
        
        // Define the Video object, which will be uploaded as the request body.
        Video video = new Video();
        
        // Add the snippet object property to the Video object.
        VideoSnippet snippet = new VideoSnippet();
        snippet.setCategoryId("22");
        snippet.setDescription("Description of uploaded video.");
        snippet.setTitle("Test video upload.");
        video.setSnippet(snippet);
        
        // Add the status object property to the Video object.
        VideoStatus status = new VideoStatus();
        status.setPrivacyStatus("private");
        video.setStatus(status);

        // TODO: For this request to work, you must replace "YOUR_FILE"
        //       with a pointer to the actual file you are uploading.
        //       The maximum file size for this operation is 137438953472.
        File mediaFile = new File("YOUR_FILE");
        InputStreamContent mediaContent =
            new InputStreamContent("application/octet-stream",
                new BufferedInputStream(new FileInputStream(mediaFile)));
        mediaContent.setLength(mediaFile.length());

        // Define and execute the API request
        YouTube.Videos.Insert request = youtubeService.videos()
            .insert("snippet,status", video, mediaContent);
        Video response = request.setKey(DEVELOPER_KEY).execute();
        System.out.println(response);
    }
}

You can also look at another example java code for uploading a video to YouTube on GitHub.

Note that you will need to make a few changes to this:

Under Android, you don't have a main. You will need to (1) put that code whereever you need to and you might want to (2) do it asynchronously.

When using Kotlin, you will also (3) need to modify the syntax accordingly.

Find elsewhere
🌐
DZone
dzone.com › coding › frameworks › youtube data api (v3): introduction with spring boot
YouTube Data API (v3): Introduction With Spring Boot - DZone
September 17, 2019 - YouTube is a video-sharing website where users can view and upload videos. For both web and app development, sometimes we need to access information from YouTube videos. You may also like: Build a Spring Boot API Using Spring Data JPA and Hibernate · In this case, we have to use the API's provided by Google developers. The main goal of this article is to introduce how we can use YoutTube APIs with Java.
🌐
Stack Overflow
stackoverflow.com › questions › 54431475 › correct-way-to-upload-video-to-youtube-through-api-from-android
java - Correct way to upload video to youtube through API from android - Stack Overflow
You can try the YouTube Direct Lite for Android. "The code is a reference implementation for an Android OS application that captures video, uploads it to YouTube, and submits the video to a YouTube Direct Lite instance".
🌐
Google
developers.google.com › resources › api-libraries › documentation › youtube › v3 › java › latest › com › google › api › services › youtube › YouTube.Videos.Insert.html
YouTube.Videos.Insert (YouTube Data API v3 (Rev. 222) 1.25.0)
protected Insert(java.lang.String part, Video content) Uploads a video to YouTube and optionally sets the video's metadata. Create a request for the method "videos.insert". This request holds the parameters needed by the the youtube server. After setting any optional parameters, call the ...
🌐
Stack Overflow
stackoverflow.com › questions › 77338588 › how-to-upload-a-youtube-video-using-youtube-data-v3-api-with-android-studio
java - How to upload a youtube video using youtube data v3 api with android studio - Stack Overflow
From your link select 'Upload a Video', change the 'Resource' dropdown to 'Video' and 'Method' dropdown to 'insert', read docs, then on the right hand side panel add required params, then scroll down to bottom and click on 'show code' (or click ...
🌐
Google
developers.google.com › youtube › data api › upload a video
Upload a Video | YouTube Data API | Google for Developers
September 14, 2026 - description: The description of the video that you're uploading. The default value is Test description. Example: --description="Had fun surfing in Santa Cruz" category: The category ID for the YouTube video category associated with the video.
🌐
Stack Overflow
stackoverflow.com › questions › 36446973 › how-can-i-upload-video-using-android-youtube-api
How can i upload video using android youtube api? - Stack Overflow
URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("PUT"); conn.setRequestProperty("Authorization", String.format("Bearer %s", access_token)); conn.setRequestProperty("Content-Type", "video/*"); conn.setRequestProperty("Content-Length", ContentLength); File file = new File(path); FileInputStream fis = new FileInputStream(file); DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); int numberBytes = fis.available(); byte bytearray[] = new byt
🌐
Google
developers.google.com › youtube › data api › use cases and code snippets
Use Cases and Code Snippets | YouTube Data API | Google for Developers
April 19, 2022 - Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates ...
🌐
Stack Overflow
stackoverflow.com › questions › 21103048 › upload-video-to-youtube-data-api-v3-without-using-the-java-client-library
Upload video to YouTube Data API v3 without using the Java Client Library - Stack Overflow
January 13, 2014 - Direct upload equivalent of the documentation, would be just setting uploadType=direct. You can set directUploadEnabled to true in this example and see the Post request to make sure. https://github.com/youtube/api-samples/blob/master/java/src/main/java/com/google/api/services/samples/youtube/cmdline/data/UploadVideo.java#L136
🌐
YouTube
youtube.com › watch
Upload a video to YouTube with the YouTube Data API - YouTube
Upload a video to YouTube with the YouTube Data API with ruby on rails.Code: https://github.com/cjavdev/video_automationTwitter: https://twitter.com/cjav_dev
Published: March 15, 2021
🌐
Google
developers.google.com › youtube › data api › videos: insert
Videos: insert | YouTube Data API | Google for Developers
July 8, 2026 - Uploads a video to YouTube and optionally sets the video's metadata. This method supports media upload.
🌐
Stack Overflow
stackoverflow.com › questions › 70728086 › uploading-a-youtube-video-using-youtube-data-api-v3-using-google-api-client-java
Uploading a YouTube Video Using YouTube Data API V3 using Google API Client JavaScript - Stack Overflow
I visited the Youtube Data v3 API docs to know about how to upload videos using the client library I got to this page https://developers.google.com/youtube/v3/docs/videos/insert but it doesn't seem...
Top answer
1 of 1
1

Based on your requirements, it seems you're looking for a way to use the YouTube API for personal use without going through the extensive review process required for public applications. Unfortunately, there isn't a built-in way to restrict API access to local use only in the YouTube API.

However there is be a workaround for your needs:

  1. You can use the YouTube Data API v3 with OAuth 2.0 authentication for your personal Google account.
  2. This method allows you to create a project in the Google Developers Console and use the API without going through the verification process, as long as you're the only user.

Here's how you can set this up:

  1. Go to the Google Developers Console.
  2. Create a new project.
  3. Enable the YouTube Data API v3 for your project.
  4. Create OAuth 2.0 credentials (Client ID and Client Secret) for a desktop application.
  5. Use these credentials in your application.

First of all you need a method to handle OAuth 2.0 authentication then you just need to add a method for uploading videos.

Here's a example how you can implement a YouTubeAPI class in python to include a video upload method:

from googleapiclient.http import MediaFileUpload

class YouTubeAPI:

    def upload_video(self, file_path, title, description, category_id, privacy_status='private'):
        body = {
            'snippet': {
                'title': title,
                'description': description,
                'categoryId': category_id
            },
            'status': {
                'privacyStatus': privacy_status
            }
        }

        media = MediaFileUpload(file_path, resumable=True)

        request = self.youtube.videos().insert(
            part='snippet,status',
            body=body,
            media_body=media
        )

        response = request.execute()
        return response

Then you can add a new endpoint to handle video uploads. This setup allows you to use the YouTube API for personal use without going through the extensive review process. However, keep in mind:

  1. The API quota is limited for unverified apps.
  2. This should only be used for personal projects where you're the only user.
  3. You'll need to handle the OAuth flow manually

Include the necessary packages:

google-api-python-client
google-auth-oauthlib
google-auth-httplib2

as long as you're the only user of the application this solution can allow you to upload videos programmatically while avoiding the extensive review process. Good luck :)