MATLAB: Can’t Upload a Video to YouTube. Problem with Java Class files and service.se​tUserCrede​ntials

java archiveuploadvideoyoutube

I am trying to upload a video to youtube from matlab using this spiffy code: http://www.mathworks.com/matlabcentral/fileexchange/19258-upload-a-video-to-youtube%E2%84%A2.
I updated the clientID and the developerKey. But I still get the same error at service.setUserCredentials(username, password). I am using a gmail account and password, which should be a valid login. I tried several and I still can't get this code to work. Any help would be appreciated.
My feeling is that I need use a different login class (GoogleService.setUserCredentials). And call these classes instead getAuthToken, setUserCredentials in GoogleAuthTokenFactory.
Here is the error message.
Java exception occurred: com.google.gdata.util.AuthenticationException: Error connecting with login URI
at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:489)
at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:301)

Best Answer

There are several bugs with this code. The native cacerts file, developerKey, and clientID are all issues. The java archives also packaged with matlab might also be at fault. I was able to successfully upload videos to matlab by doing the following:
2) I wrote a small script to upload videos:
uploadmovie(moviefile,mystr,mycategory) % uploadmovie % uploadmovie automatically uploads a game movie to youtube.
% HISTORY: % Version 1.0, 2011-10-21.. commandline_str = ['google youtube post ' ... '--category ' mycategory.... ' --summary "' mystr '"'... ' "' movie_file '"'];
system(commandline_str);
This works very well. You have to do a few things. You still need to register your account to get a clientid and developerkey from google. Then enter put the clientid in your web browser. Google will ask you to confirm that this computer can remote access your google account. There a few more steps but it is pretty intuitive. Good luck! Let me know if this was helpful.
Related Question