OWASP O2 Platform Blog

O2 Script to get YouTube videos list

Based on the Accessing YouTube via its C# API script , here are two more uses of the YouTube C# API:

Video

Scripts

Create HTML list of videos (used to create this blog post entry)

panel.clear();
var googleDevKey = "AI39si4VZRef7hm9N-RBZ5u-5x5N2lIgyEvv45dGgDxCJjltduhlnF9tTmfWV55tFMUWbnThHybbipiXiEufJueJPpF65lkyjg ";
var settings = new YouTubeRequestSettings("API_YouTube",googleDevKey);
settings.PageSize = 50;
var youTubeRequest = new YouTubeRequest(settings);

Feed<Video> feed = youTubeRequest.GetVideoFeed("DinisCruz");

var webBrowser = panel.add_WebBrowser_Control();

var htmlCode = "<ul>";
var index = 1;
foreach(var entry in feed.Entries)
{
    htmlCode += "<li><a href='{1}'>{0}</a>  - {2:MMM yy}</li>"
                    .format(entry.str(),
                            entry.WatchPage.str(),
                            entry.AtomEntry.Published,
                            index++);
}
htmlCode += "</ul>";
webBrowser.open(htmlCode.saveWithExtension(".html"));

return "done";

//using Google.YouTube
//using Google.GData.Client
//using Google.GData.YouTube
//O2Ref:Google.GData.Client.dll
//O2Ref:Google.GData.YouTube.dll
//O2Ref:Google.GData.Extensions.dll

Mini Gui to View Blog Posts

panel.clear();
var googleDevKey = "AI39si4VZRef7hm9N-RBZ5u-5x5N2lIgyEvv45dGgDxCJjltduhlnF9tTmfWV55tFMUWbnThHybbipiXiEufJueJPpF65lkyjg ";
var settings = new YouTubeRequestSettings("API_YouTube",googleDevKey);

var youTubeRequest = new YouTubeRequest(settings);
Feed<Video> feed = youTubeRequest.GetVideoFeed("DinisCruz");
var treeView = panel.clear().add_Panel().add_TreeView();
var webBrowser = treeView.insert_Right().add_WebBrowser_Control();
treeView.afterSelect<Video>(
	(video)=>{
				webBrowser.open(video.WatchPage.str());
			 });
foreach(var entry in feed.Entries)
	treeView.add_Node(entry);
treeView.selectFirst();
//feed.details();
//panel.add_TableList().show(feed.Entries);

return "done";

//using Google.YouTube
//using Google.GData.Client
//using Google.GData.YouTube
//O2Ref:Google.GData.Client.dll
//O2Ref:Google.GData.YouTube.dll
//O2Ref:Google.GData.Extensions.dll

April 21, 2012 - Posted by | Interoperability

1 Comment »

  1. […] you want to see how I created this list, take a look at the first video or at O2 Script to get YouTube videos list Share this:TwitterEmailDiggRedditStumbleUponPrintLike this:LikeBe the first to like this […]

    Pingback by 39 O2 Platform videos with 12k YouTube views « OWASP O2 Platform Blog | April 21, 2012 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: