BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Google Has Released a YouTube SDK for .NET

| by Abel Avram Follow 3 Followers on Feb 24, 2010. Estimated reading time: 1 minute |

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 Stage
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.

Tell us what you think

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

Email me replies to any of my messages in this thread
Community comments

cool! by Lu Laser

Real glad to hear that;-)

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT