Category Archives: YouTube

Displaying Selected YouTube Data API Thumbnails On A Web Page Via ASP.NET Web Forms

Previously, I blogged about “Displaying Selected YouTube Video Thumbnails On An ASP.NET Web Forms Page,” when you know the video IDs of the thumbnails you want to hyperlink.

A reader recently asked me how to hyperlink YouTube video thumbnails based on searching for a keyword. I promised to address that, so here goes.

Interestingly enough, searching the YouTube Data API is accomplished in a REST-like manner quite similar to the methodology I used for shortening URLs in ASP.NET via the bit.ly API.

  • Form a simple request URL to the YouTube Data API that contains the appropriate search parameters;
  • Use a WebRequest to send that URL to Google, which returns an XML document with results;
  • Use WebResponse to dump that stream into an XmlDocument;
  • Use XPath and XmlNode‘s SelectNodes method to recursively get the thumbnails from each entry; and
  • Bind up a pile of Hyperlink controls, which are added dynamically to a Panel control.

Sounds more complicated than it actually is. Let’s do it.
Continue reading