Sunday, 21 June 2015

YouTube Comments and Commenting with YouTube API V3 (Google.Apis.YouTube.v3)




Google deprecated V2 of the YouTube API over a year ago, but as of last month, the URLs have been taken offline; forcing users to upgrade to V3 of the API. One of the last features requiring implementating on the V3 platform was the ability to comment on channels and videos. The following example shows how to leave a top level comment on a channel or video using V3 of the API with C#

Example
Code Snippet
  1.  
  2. YouTubeService youtube; // Init your service here - Make sure you include the new required scope: YouTubeService.Scope.YoutubeForceSsl
  3.  
  4. CommentThreadSnippet commentThreadSnippet = new CommentThreadSnippet();
  5. //commentThreadSnippet.ChannelId; Comment on a channel - leave video id blank if so
  6. commentThreadSnippet.VideoId = v.ID; // Comment on a Video by VideoID
  7.  
  8. // A top level comment is a new comment (Not a reply to an existing comment)
  9. commentThreadSnippet.TopLevelComment = new Comment() { Snippet = new CommentSnippet() { TextOriginal = comment }};
  10.  
  11. // Make an insert request and get result snippet
  12. CommentThreadsResource.InsertRequest commentReq = youtube.CommentThreads.Insert(new CommentThread() { Snippet = commentThreadSnippet}, "snippet");
  13. CommentThread commentRes = commentReq.Execute();
End of Code Snippet

3 comments:

Anh Tuấn said...

hi mate! can you make full code for youtube comment with API v3?

Queens Technology said...

GREATTT Thanks a lot

zoha khan said...

Do you like watching videos on YouTube? Would you like to get paid to watch videos, post comments, and ‘like’ videos?

Well, this is exactly what thousands of people just like you are doing right now. They are called ‘Social Media Managers’ and they are getting paid great money to work online doing simple tasks on YouTube such as:

Commenting on YouTube videos
Posting video responses to videos
Getting more ‘likes’ and views for videos
Uploading videos and managing YouTube accounts for businesses.
As long as you know how to use YouTube, have an internet connection and a few hours to spare per week then you can make great money doing simple jobs on YouTube. Click the link below to get started:

https://clicktrix.com?dominik1412