Search code examples
c#formatprotocolswebclient

Downloading youtube video info


I am trying to download response from this url

http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I

The file it returns can be downloaded from browser, but when I try to save it with c# webclient I get only error message.

errorcode=180&status=fail&reason=HTTP+is+not+supported.

Is there any other way to download file from the API without using HTTP?

What have I tried (a is instance of WebClient):

byte[] policko = a.DownloadData("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I");
a.DownloadFile("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I", "filename");
a.DownloadString("http://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I");

Solution

  • The response you got indicates that HTTP is not supported for this API call. The next natural choice is HTTPS.

    https://www.youtube.com/get_video_info?html5=1&video_id=sFwcLC5HC9I