JYouTube - Upload Videos to YouTube
 
The Google GData APIs for YouTube allow for programmatically searching and retrieving YouTube content in 1000 ways, but it does not provide for uploading new content. I have written a GPLed Java utility for doing just this. It was originally a port of PHPTube by Michael Kamleitner, but I added some progress meter functionality beyond that, as well as changing some of the “RegEx” mechansims he used for parsing the HTML pages. My derivative work is also GPLed.
 
You can download it here: JYouTube.zip
 
To use the library, you basically just make a call like this:
 
JYouTube tube = new JYouTube ("yourYouTubeUsername","yourYouTubePassword");
 
//Add a progress listener if you wish, to get byte progress events        
//tube.addListener(tube);
tube.addListener(this);
        
String id = tube.upload("MVI_0193.AVI",          //Filename
                        "JYouTube Upload",       //Video Title
                        "JYouTube",              //Tags or Keywords
                        "Video uploaded with JYouTube", //Description
                        JYouTube.Catgeory.MUSIC, //Category
                        "US",                    //Langauge
                        true                     //Public?
                       );        
 
//Do something with the new VideoId!!
System.out.println("New youtube video id is:" + id);
 
 
That’s it! Pretty easy! Have fun...
 
 
JYouTube
Wednesday, November 7, 2007