title: download youtube video in C++
body: <p>I am writing a method that should download the .flv video from youtube and save it to hard drive. I've read all around everything, source code available, forums, but I cannot get my code to work. I think youtube has removed this feature and it is no longer possible to download videos. But then comes the question: how do some programs free and commercial do it?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    WebClient^ client = gcnew WebClient();
  
   String^ page = client-&gt;DownloadString(URL);
  
    String^ videoId = innerValue(URL, "v=", "&amp;");
  
    String^ details = client-&gt;DownloadString("http://www.youtube.com/get_video_info?&amp;video_id=" + videoId);
  
    String^ t1 = innerValue(page, "&amp;t=", "&amp;");
  
    String^ t2 = HttpUtility::UrlDecode(innerValue(details, "&amp;token=", "&amp;"));
  
    String^ videoUrl = String::Format("http://www.youtube.com/get_video?video_id={0}&amp;t={1}&amp;fmt={2}", videoId, t2, fmt);
  
    client-&gt;DownloadFile(videoUrl, gcnew String(file));
  </code></pre>
  
  <p>InnerValue method just gets the text between the two params. No matter if I use "t1" or "t2", it still does not work!</p>
  
  <p>Let me know what I do wrong?</p>
  
  <p>Thanks</p>