Coding4Fun
10 .NET Programming Projects for Wiimote, World of Warcraft, YouTube and More

Ch 4: InnerTube

In this chapter, you will take a tour of InnerTube, an application that downloads, converts, and syncs YouTube videos. Although it is not required, InnerTube can sync videos with the following optional hardware devices: iPod, iPhone, or Zune.


Posted Aug 21 2008, 12:08 AM by Brian Peek
Filed under:

Comments

PaulQ wrote re: Ch 4: InnerTube
on Wed, Feb 17 2010 1:46 PM

When I run InnerTube I get back a bad link from the Downloads code page:

The link is correct i can put it in my browser just fine, but the rawHtml has this in it:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/.../loose.dtd">

... So it never finds swfArgs and my  jsIndex is -1

private static string CreateTokenRequest(InnerTubeVideo video)

       {

           //YouTube variables

           const string jsVariable = "swfArgs";

           const string argName = "t";

           //get raw html from YouTube video page

           string rawHtml;

           using (WebClient wc = new WebClient())

           {

               MessageBox.Show(" Link = " +video.Link.ToString());

               rawHtml = wc.DownloadString(video.Link);

           }

           //extract the JavaScript name/value pairs

           int jsIndex = rawHtml.IndexOf(jsVariable);

           int startIndex = rawHtml.IndexOf("{", jsIndex);

           int endIndex = rawHtml.IndexOf("}", startIndex);

           string fullString = rawHtml.Substring(startIndex + 1, endIndex - startIndex - 1);

Powered by Community Server (Non-Commercial Edition), by Telligent Systems