BT

InfoQ Homepage News Google Has Released a YouTube SDK for .NET

Google Has Released a YouTube SDK for .NET

Bookmarks

Google has released a YouTube SDK for .NET (MSI) for those interested in programmatically accessing YouTube from a .NET or ASP.NET application.

The SDK contains a CHM help file for the YouTube API, a Visual Studio 2008 template and several application samples demonstrating the API possible usage: a tool for uploading video files to YouTube, an ASP.NET mini-website using AuthSub, an authorization service supported by YouTube, and an application which notifies on selected user YouTube activity.

The YouTube API is built on top of Google’s GData protocol (MSI), extending it with specific data classes contained in the Google.GData.YouTube namespace. GData is an open source protocol for web communication and used extensively by Google for many of its services: Blogger, Calendar, Picasa, YouTube, and others.

The following code sample taken from the SDK’s help file shows the usage of LINQ’s chained where clause in the context of accessing YouTube:

YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", YTCLIENTID, YTDEVKEY);

YouTubeRequest f = new YouTubeRequest(settings);
settings.AutoPaging = true;
settings.Maximum = 200; //only 75 come back but that is a feature
Feed<Video> sfeed = f.GetStandardFeed(YouTubeQuery.MostPopular);

//put the entire list into a list.
var entries = sfeed.Entries.ToList();

var oneHunderTitles = from e in entries
                      where e.ViewCount > 100
                      where e.Rating > 2
                      where e.Updated < new DateTime(2008, 12, 4)
                      orderby e.Rating descending
                      orderby e.Title
                      select e;

foreach (var item in oneHunderTitles) {
    Console.WriteLine(item.Title);
}

//here is an inline orderby on title as a lambda
foreach (var item in entries.OrderBy(i => i.Title)) {
    Console.WriteLine(item.Title);
}

Console.WriteLine(sfeed.Entries.Count());

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • cool!

    by Lu Laser /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Real glad to hear that;-)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.