我試圖從vimeo下載視頻)與c#。 問題是,當我必須接收代碼302來執行重定向時,我收到代碼200(帶有「Permision denied」的頁面)。 這是代碼:從vimeo下載視頻
string url = "http://player.vimeo.com/play_redirect?clip_id=" + clip_id + "&sig=" + request_signature + "&time=" + request_signature_expires + "&quality=" + hd + "&codecs=H264,VP8,VP6&type=moogaloop_local&embed_location=";
_VideoURL = GetHttpSpecial(url, cookies);
public string GetHttpSpecial(string url, CookieContainer cookies)
{
string html = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.Headers.Add("Accept-Language: nl,en-us;q=0.7,en;q=0.3");
request.Headers.Add("Accept-Encoding: gzip, deflate");
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0";
request.KeepAlive = true;
request.Timeout = 20000;
request.AllowAutoRedirect = false;
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
foreach (Cookie cookie in response.Cookies)
{
cookies.Add(cookie);
}
if (response.StatusCode == HttpStatusCode.OK)
{
try
{
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
try
{
html = reader.ReadToEnd();
}
finally
{
reader.Close();
}
}
finally
{
response.Close();
}
return html;
}
else
{
if (response.StatusCode == HttpStatusCode.Found)
{
return response.Headers["Location"].ToString();
}
else
{
return "error: server returned status description:" + response.StatusDescription;
}
}
}
請問您能幫我嗎?
感謝
嗨薩拉,歡迎來到這個網站。當你以編程方式嘗試下載視頻或僅通過網站使用vimeo時,你是否看到了這一點? – StuperUser 2011-12-19 12:18:52
我試圖用我的應用程序編程從vimeo下載視頻 – 2011-12-19 12:23:08