Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:11:04+00:00 2026-05-31T04:11:04+00:00

I feel really silly to not be able to find this answer anywhere. Could

  • 0

I feel really silly to not be able to find this answer anywhere. Could someone please direct me to a place or inform me of what the YouTube limits are with regard to keywords?
I found that the limit was once 120 characters, but then I heard it changed in March 2010 to 500 characters so it shouldn’t be a problem for me if that’s true. It’s possible I have another problem on my hands. Maybe someone could help me with that one…

I’m using the YouTube API for Java using direct upload from a client based application. I have tons of videos I’m trying to upload to several different accounts at once (each in a different language). So I’m using threads to accomplish this. I limit the number of concurrent uploads to 10 just to try and play it safe. None of the descriptions will be much longer than 500 characters and because of this error I’m getting, I had the keywords automatically limit themselves to 120 characters (I even tried to limit it to 70 characters and had the same problem). So, I’m not sure at all why this is happening. The error I get from Google is:

SEVERE: null
com.google.gdata.util.InvalidEntryException: Bad Request
<?xml version='1.0' encoding='UTF-8'?>
  <errors>
    <error>
      <domain>yt:validation</domain>
      <code>too_long</code>
      <location type='xpath'>media:group/media:keywords/text()</location>
    </error>
  </errors>

I’m also getting an InvalidEntryException as an error code, but I’ll deal with that later (I think it has to do with my authentication timing out or something).

Anyway, I don’t get this error on every video. In fact, most videos make it just fine. I haven’t yet tested to find out which videos are throwing the error (I will do that when I’m finished with this post), but it’s beyond me why I’m getting this error. I’ll post my code here, but it’s pretty much exactly what’s on the api documentation, so I don’t know whether it’ll be much help. I’m guessing there’s something fundamental I’m missing.

uploadToYouTube():

  private void uploadToYouTube() throws IOException, ServiceException {
    TalkContent talkContent = transfer.getTalkContent();
    YouTubeService youTubeService = talkContent.getLanguage().getYouTubeService(); //see code for this below...

    String title = talkContent.getTitle();
    String category = talkContent.getCategory();
    String description = talkContent.getDescription();
    List<String> tags = talkContent.getTags();
    boolean privateVid = true;

    VideoEntry newEntry = new VideoEntry();
    YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();

    //Title
    mg.setTitle(new MediaTitle());
    mg.getTitle().setPlainTextContent(title);

    //Description
    mg.setDescription(new MediaDescription());
    mg.getDescription().setPlainTextContent(description);

    //Categories and developer tags
    mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, category));
    mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "kentcdodds"));
    mg.addCategory(new MediaCategory(YouTubeNamespace.DEVELOPER_TAG_SCHEME, "moregoodfoundation"));

    //Keywords
    mg.setKeywords(new MediaKeywords());
    int tagLimit = 70; // characters
    int totalTags = 0; //characters
    for (String tag : tags) {
      if ((totalTags + tag.length()) < tagLimit) {
        mg.getKeywords().addKeyword(tag);
        totalTags += tag.length();
      }
    }

    //Visible status
    mg.setPrivate(privateVid);

    //GEO coordinantes
    newEntry.setGeoCoordinates(new GeoRssWhere(40.772555, -111.892480));

    MediaFileSource ms = new MediaFileSource(new File(transfer.getOutputFile()), transfer.getYouTubeFileType());
    newEntry.setMediaSource(ms);

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

    VideoEntry createdEntry = youTubeService.insert(new URL(uploadUrl), newEntry);
    status = Transfer.FINISHEDUP;
  }

getYouTubeService():

  public YouTubeService getYouTubeService() {
    if (youTubeService == null) {
      try {
        authenticateYouTube();
      } catch (AuthenticationException ex) {
        JOptionPane.showMessageDialog(null, "There was an authentication error!" + StaticClass.newline + ex, "Authentication Error", JOptionPane.ERROR_MESSAGE);
        Logger.getLogger(Language.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
    return youTubeService;
  }

authenticateYouTube():

  public void authenticateYouTube() throws AuthenticationException {
    if (youTubeService == null) {
      System.out.println("Authenticating YouTube Service");
      youTubeService = new YouTubeService("THENAMEOFMYPROGRAM", "THEDEVELOPERIDHERE");
      youTubeService.setUserCredentials(youTubeUsername, youTubePassword);
      System.out.println("Authentication of YouTube Service succeeded");
    }
  }

Any help on this would be great! Also, before I call the uploadToYouTube() method, I print out that the video’s being uploaded to YouTube and after the method call I print out that it finished. Can someone explain why those are printed out within moments of one another? I’m not starting a new thread for the uploadToYouTube() method, I’m guessing that in the insert() method on the youTubeService there’s a new thread started for the upload. It’s a little annoying though because I’m never quite sure at what point the video finishes uploading and if I stop the program before it’s through then the video stops uploading.

Anyway! Thanks for reading all of this! I hope someone can help me out!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:11:05+00:00Added an answer on May 31, 2026 at 4:11 am

    The solution was really simple! The problem was even though I’m not over the 500 character limit for total tags, but sometimes I was over the limit of 30 characters per tag! I just changed tag adding lines to the following code:

    //Keywords
    mg.setKeywords(new MediaKeywords());
    int totalTagsLimit = 500; // characters
    int singleTagLimit = 30; // characters
    int totalTags = 0; //characters
    for (String tag : tags) {
      if ((totalTags + tag.length()) < totalTagsLimit && tag.length() < singleTagLimit) {
        mg.getKeywords().addKeyword(tag);
        totalTags += tag.length();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel really silly for asking this , but how do I place buttons
I feel really dumb for not being able to figure this out so here
I feel like this might be really simple but I'm just not getting it
I feel like there's a simple solution to this, but I'm not really sure
I feel like this is a silly question but I always find that modifying
I feel really silly for asking this, but what am I doing wrong with
I feel kind of silly asking this question as it seems really simple, but
I feel really silly for having to ask this head desk but I've got
I feel really silly asking this because I know how to do it 101
I feel really silly asking this question but how do you add any data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.