I was integrating the .NET API SDK into our website. I had to simply
upload (from a source, not browser based upload), preview and delete
video into our channel. Everything worked very well on my machine but
when I deployed all that on our live server I've received some
disturbing exceptions. No matter on what other machine different from
my PC I deploy my code my YouTubeRequest instance throws :
Execution of request failed: http://uploads.gdata.youtube.com/feeds/api/users/default/uploads
-=Stack Trace=- :
at Google.GData.Client.GDataRequest.Execute()
at Google.GData.Client.GDataGAuthRequest.Execute(Int32
retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute(Int32
retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute(Int32
retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute(Int32
retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute()
at Google.GData.Client.MediaService.EntrySend(Uri feedUri, AtomBase
baseEntry, GDataRequestType type, AsyncSendData data)
at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry
newEntry, AsyncSendData data)
at Google.GData.Client.Service.Insert[TEntry](Uri feedUri, TEntry
entry)
at Google.GData.YouTube.YouTubeService.Upload(String userName,
YouTubeEntry entry)
at Google.YouTube.YouTubeRequest.Upload(String userName, Video v)
at Google.YouTube.YouTubeRequest.Upload(Video v)
The inner exception is Bad Request (400).
Here is how I'm using the API :
private YouTubeRequest GetYouTubeRequest()
{
return new YouTubeRequest(new
YouTubeRequestSettings(Config.YOUTUBE_APPLICATION_NAME,
Config.YOUTUBE_API_KEY,
Config.YOUTUBE_USERNAME,
Config.YOUTUBE_PASSWORD));
}
public bool Upload(UserDto user, string path)
{
try
{
Video newVideo = new Video();
newVideo.Title = user.FirstName + "'s
findababysitter.com profile video";
newVideo.Keywords = "findababysitter.com , childcare,
babysitter, nanny";
newVideo.Media.Categories.Add(new
MediaCategory("Autos"));
newVideo.Description = "Visit " + user.FirstName + "'s
profile at http://www.findababysitter.com/profile/" + user.Id + " !";
newVideo.YouTubeEntry.Private = true;
newVideo.YouTubeEntry.MediaSource = new
MediaFileSource(path,
MediaFileSource.GetContentTypeForFileName(path));
Video createdVideo =
GetYouTubeRequest().Upload(newVideo);
m_uvRep.Save(new tUserVideo()
{
UserID = user.Id.Value,
YouTubeID = createdVideo.VideoId
});
return true;
}
catch (Exception ex)
{
ErrorLog.WriteExceptionLogVerbose("Error while
uploading video for userId :" + user.Id, ex);
return false;
}
finally
{
FileService.DeleteFileFullPath(path);
}
}
On the line Video createdVideo = GetYouTubeRequest().Upload(newVideo);
I got this exception.
My youtube details (copy from my web.config, password hidden) :
<add key="YOUTUBE_APPLICATION_NAME" value="Findababysitter.com" />
<add key="YOUTUBE_API_KEY"
value="AI39si5DrLm2t-8FG6nvORGezDYUlB_OwRb9WKB5kA3eLBQEB0hN_qondNRiW4dlzxd3GhjiBlLxWUOQe1TNxcYki27yhcDoA" /
>
<add key="YOUTUBE_USERNAME" value="tom@findababysitter.com" />
<add key="YOUTUBE_PASSWORD" value="*******" />
<add key="YOUTUBE_CHANNEL_NAME" value="findababysitter" />
Can someone help me why I'm experiencing this issue?
Thanks,
Nikolay Stoyanov,
www.findababysitter.com
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment