BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Google Has Released a YouTube SDK for .NET

by Abel Avram on Feb 24, 2010 |

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());

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

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT