本文整理汇总了C#中YouTubeRequest.GetComments方法的典型用法代码示例。如果您正苦于以下问题:C# YouTubeRequest.GetComments方法的具体用法?C# YouTubeRequest.GetComments怎么用?C# YouTubeRequest.GetComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YouTubeRequest
的用法示例。
在下文中一共展示了YouTubeRequest.GetComments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: YouTubePageSizeTest
/////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
/// <summary>runs a test on the YouTube factory object</summary>
//////////////////////////////////////////////////////////////////////
[Test] public void YouTubePageSizeTest()
{
Tracing.TraceMsg("Entering YouTubePageSizeTest");
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd);
settings.PageSize = 15;
YouTubeRequest f = new YouTubeRequest(settings);
Feed<Video> feed = f.GetStandardFeed(YouTubeQuery.MostPopular);
int iCount = 0;
// this will get you just the first 15 videos.
foreach (Video v in feed.Entries)
{
iCount++;
f.Settings.PageSize = 5;
Feed<Comment> list = f.GetComments(v);
int i = 0;
foreach (Comment c in list.Entries)
{
i++;
}
Assert.IsTrue(i <= 5, "the count should be smaller/equal 5");
Assert.IsTrue(list.PageSize == -1 || list.PageSize == 5, "the returned pagesize should be 5 or -1 as well");
}
Assert.AreEqual(iCount, 15, "the outer feed should count 15");
Assert.AreEqual(feed.PageSize, 15, "outer feed pagesize should be 15");
}
示例2: YouTubeCommentRequestTest
public void YouTubeCommentRequestTest() {
Tracing.TraceMsg("Entering YouTubeCommentRequestTest");
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd);
YouTubeRequest f = new YouTubeRequest(settings);
Feed<Video> feed = f.GetStandardFeed(YouTubeQuery.MostPopular);
// this will get you the first 25 videos, let's retrieve comments for the first one only
foreach (Video v in feed.Entries) {
Feed<Comment> list = f.GetComments(v);
foreach (Comment c in list.Entries) {
Assert.IsTrue(c.AtomEntry != null);
Assert.IsTrue(c.Title != null);
}
break;
}
}
示例3: YouTubeUnAuthenticatedRequestTest
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/// <summary>runs a test on the YouTube factory object</summary>
//////////////////////////////////////////////////////////////////////
[Test] public void YouTubeUnAuthenticatedRequestTest()
{
Tracing.TraceMsg("Entering YouTubeUnAuthenticatedRequestTest");
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey);
settings.AutoPaging = true;
settings.Maximum = 50;
YouTubeRequest f = new YouTubeRequest(settings);
Feed<Video> feed = f.GetStandardFeed(YouTubeQuery.MostPopular);
// this will get you just the first 25 videos.
foreach (Video v in feed.Entries)
{
Feed<Comment> list= f.GetComments(v);
foreach (Comment c in list.Entries)
{
Assert.IsTrue(c.AtomEntry != null);
Assert.IsTrue(c.Title != null);
}
}
}
示例4: updateCommentBw_DoWork
private void updateCommentBw_DoWork(object sender, DoWorkEventArgs e)
{
YouTubeRequest req = new YouTubeRequest(new YouTubeRequestSettings("YoutubeUploader", MainWindow.DEV_KEY));
Uri videoEntryUrl = new Uri(string.Format("{0}/{1}", Google.GData.YouTube.YouTubeQuery.DefaultVideoUri, videoId));
Google.YouTube.Video newVideo = req.Retrieve<Google.YouTube.Video>(videoEntryUrl);
Feed<Comment> comments = req.GetComments(newVideo);
List<object> arg = new List<object>();
arg.Add(comments);
e.Result = arg;
}