本文整理汇总了C#中YouTubeRequest.GetVideoFeed方法的典型用法代码示例。如果您正苦于以下问题:C# YouTubeRequest.GetVideoFeed方法的具体用法?C# YouTubeRequest.GetVideoFeed怎么用?C# YouTubeRequest.GetVideoFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YouTubeRequest
的用法示例。
在下文中一共展示了YouTubeRequest.GetVideoFeed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallYoutube
void CallYoutube ()
{
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
var yreq = new YouTubeRequest (new YouTubeRequestSettings ("MonoTouchSample", "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q"));
var feed = yreq.GetVideoFeed ("xamarinhq");
feed.Entries.ToList ().ForEach ((video) => {
data.Add (video.Title);
}
);
InvokeOnMainThread (delegate {
TableView.ReloadData ();
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
}
);
}
示例2: YouTubePrivateTest
public void YouTubePrivateTest()
{
Tracing.TraceMsg("Entering YouTubePrivateTest");
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd);
settings.PageSize = 15;
settings.AutoPaging = true;
YouTubeRequest f = new YouTubeRequest(settings);
Feed<Video> feed = f.GetVideoFeed(null);
Video privateVideo = null;
foreach (Video v in feed.Entries)
{
if (v.IsDraft==false)
{
v.YouTubeEntry.Private = true;
privateVideo = f.Update(v);
}
else
{
// there should be a state as well
State s = v.YouTubeEntry.State;
Assert.IsNotNull(s, "state should not be null");
Assert.IsNotNull(s.Reason, "State.Reason should not be null");
}
}
Assert.IsTrue(privateVideo != null, "we should have one private video");
Assert.IsTrue(privateVideo.YouTubeEntry.Private == true, "that video should be private");
privateVideo.YouTubeEntry.Private = false;
Video ret = f.Update(privateVideo);
Assert.IsTrue(ret != null, "we should have one private video");
Assert.IsTrue(ret.YouTubeEntry.Private == false, "that video should be not private");
}
示例3: YouTubeRequestTest
///////////////////////// START OF REQUEST TESTS
//////////////////////////////////////////////////////////////////////
/// <summary>runs a test on the YouTube factory object</summary>
//////////////////////////////////////////////////////////////////////
[Test] public void YouTubeRequestTest()
{
Tracing.TraceMsg("Entering YouTubeRequestTest");
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd);
YouTubeRequest f = new YouTubeRequest(settings);
// GetVideoFeed get's you a users video feed
Feed<Video> feed = f.GetVideoFeed(null);
// this will get you just the first 25 videos.
foreach (Video v in feed.Entries)
{
Assert.IsTrue(v.AtomEntry != null, "There should be an atomentry");
Assert.IsTrue(v.Title != null, "There should be a title");
Assert.IsTrue(v.VideoId != null, "There should be a videoID");
}
Feed<Video> sfeed = f.GetStandardFeed(YouTubeQuery.MostPopular);
int iCountOne=0;
// this loop get's you all videos in the mostpopular video feeed
foreach (Video v in sfeed.Entries)
{
Assert.IsTrue(v.AtomEntry != null, "There should be an atomentry");
Assert.IsTrue(v.Title != null, "There should be a title");
Assert.IsTrue(v.VideoId != null, "There should be a videoID");
iCountOne++;
}
int iCountTwo = 0;
sfeed.AutoPaging = true;
sfeed.Maximum = 50;
foreach (Video v in sfeed.Entries)
{
Assert.IsTrue(v.AtomEntry != null, "There should be an atomentry");
Assert.IsTrue(v.Title != null, "There should be a title");
Assert.IsTrue(v.VideoId != null, "There should be a videoID");
iCountTwo++;
}
Assert.IsTrue(iCountTwo > iCountOne);
}
示例4: YouTubeYtRatingsDislikeTest
public void YouTubeYtRatingsDislikeTest() {
Tracing.TraceMsg("Entering YouTubeYtRatingsDislikeTest");
string videoOwner = "GoogleDevelopers";
YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd);
YouTubeRequest f = new YouTubeRequest(settings);
// GetVideoFeed gets you a users video feed
Feed<Video> feed = f.GetVideoFeed(videoOwner);
// this will get you just the first 25 videos.
foreach (Video v in feed.Entries) {
YtRating rating = new YtRating(YtRating.Dislike);
v.YouTubeEntry.YtRating = rating;
YouTubeEntry ratedEntry = f.Service.Insert(new Uri(v.YouTubeEntry.RatingsLink.ToString()), v.YouTubeEntry);
Assert.AreEqual(YtRating.Dislike, ratedEntry.YtRating.RatingValue, "YtRating should be equal to dislike");
break; // we can stop after one
}
}