Download the file from your Premium Rapidshare account using .NET.

How can I log in to a premium rapidshare account from my source? I tried this, but it does not work:

string authInfo = "name" + ":" + "pass"; authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); client.Headers["Authorization"] = "Basic " + authInfo; client.DownloadFile("url", "C:\\Temp\\aaaa.file"); 

OR

 WebClient client = new WebClient(); client.Credentials = new NetworkCredential("name", "pass"); client.DownloadFile("url", "C:\\Temp\\aaaa.file"); 

Is there any easy way to download a file directly from the rapidshare premium?

+4
source share
3 answers

Use Fiddler to see what is being sent. Then restore the request.

Download Manager logs can also contain some tips.

+3
source

A simple rapidshare class allows you to perform your task without reinventing the wheel ... Otherwise, check the API with rapidshare.

+2
source

There is my decision. work like a charm:

 private void downloadFileAsync(string fileUrl) { string uriString; uriString = "https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi"; NameValueCollection postvals = new NameValueCollection(); postvals.Add("login", "aaa"); postvals.Add("password", "bbb"); postvals.Add("uselandingpage", "1"); WebClient myWebClient = new WebClient(); Byte[] responseArray = myWebClient.UploadValues(uriString, "POST", postvals); StreamReader strRdr = new StreamReader(new MemoryStream(responseArray)); string cookiestr = myWebClient.ResponseHeaders.Get("Set-Cookie"); myWebClient.Headers.Add("Cookie", cookiestr); myWebClient.DownloadFileCompleted += new AsyncCompletedEventHandler(myClient_DownloadFileCompleted); myWebClient.DownloadFileAsync(new Uri(fileUrl),"C:\\Temp\\"+Path.GetFileName(fileUrl)); } 
+2
source

Source: https://habr.com/ru/post/1304474/


All Articles