开发者

Can't download from youtube encoding error

it's a week that I'm trying to write a program that download correctly from youtube a video

the problem is this:

I've done via httpwebrequest a simple downloader and all work well. I've tried download a mp4 video from a local server (uniform server) and all goes well, video is the same, work and is valid mp4. When I download the same video from youtube something strange happens:

It fill some characters in downloaded file with sequence EF BF BD

for example when encounter character E2 (I've compared the two files one from youtube and the original). Googling around I discover that a server return thi开发者_JS百科s kinda sequence when encounterd a invalid char for your encoding, now I'm on wp7 and I can't set

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

here's others useful data: I've try with these:

_webRequest.Method = "GET"; //also POST
_webRequest.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 6.1; it; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16";
_webRequest.Accept = @"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
_webRequest.BeginGetResponse(_onDownload, userState);

format url from youtube

Any Idea? thanks


Can you set the header using the _webRequest.Headers method? See these related questions:

Cannot set some HTTP headers when using System.Net.WebRequest

Constructing a POST in C#

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜