How to intercept Rapidshare file download in WebBrowser control?
-
I am developing a C# app which will download Rapidshare files for Free users. The program would work as follows: 1. Rapidshare webpage would open in WebBrowser control. 2. Captcha would be input in the webpage 3. File download will occur using the download manager of the app, instead of the default download manager. I have designed the download section in the following way.
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string filename = @"C:\test.rar"; Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase); string match = e.Url.AbsoluteUri; if (pattern.IsMatch(match)) { e.Cancel = true; WebClient client = new WebClient(); Uri uri = new Uri(match); client.DownloadFileAsync(uri, filename); } }
While running, the app downloads a 10KB file instead of the real one. If I use the followsing code:private void rapidWebBrowser_FileDownload(object sender, EventArgs e) { Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase); if (pattern.IsMatch(match)) // match is assigned to the required navigating url { WebClient client = new WebClient(); Uri uri = new Uri(match); client.DownloadFileAsync(uri, filename); } }
the app downloads a 10KB file and pops up IE's default download manager. How to solve the problem? I want to intercept the original file download by WebBrowser control, and pass the url to my app's custom downloader suppressing the IE's downloader. How to do this? I am eagerly waiting for the solution. Thank you in advance.Anindya Chatterjee
-
I am developing a C# app which will download Rapidshare files for Free users. The program would work as follows: 1. Rapidshare webpage would open in WebBrowser control. 2. Captcha would be input in the webpage 3. File download will occur using the download manager of the app, instead of the default download manager. I have designed the download section in the following way.
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string filename = @"C:\test.rar"; Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase); string match = e.Url.AbsoluteUri; if (pattern.IsMatch(match)) { e.Cancel = true; WebClient client = new WebClient(); Uri uri = new Uri(match); client.DownloadFileAsync(uri, filename); } }
While running, the app downloads a 10KB file instead of the real one. If I use the followsing code:private void rapidWebBrowser_FileDownload(object sender, EventArgs e) { Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase); if (pattern.IsMatch(match)) // match is assigned to the required navigating url { WebClient client = new WebClient(); Uri uri = new Uri(match); client.DownloadFileAsync(uri, filename); } }
the app downloads a 10KB file and pops up IE's default download manager. How to solve the problem? I want to intercept the original file download by WebBrowser control, and pass the url to my app's custom downloader suppressing the IE's downloader. How to do this? I am eagerly waiting for the solution. Thank you in advance.Anindya Chatterjee
Have you tried renaming the small file you get and opening it in IE? I believe Rapidshare blocks download accelerators.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Have you tried renaming the small file you get and opening it in IE? I believe Rapidshare blocks download accelerators.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
I am not at all using any accelerator. I am just using mere WebClient to download. Basically I know that using Http POST Rapidshare transfer files. But how to embed it in my app to intercept the default download manager, I don't know. That is I am searching for.
Anindya Chatterjee
-
I am not at all using any accelerator. I am just using mere WebClient to download. Basically I know that using Http POST Rapidshare transfer files. But how to embed it in my app to intercept the default download manager, I don't know. That is I am searching for.
Anindya Chatterjee
Apologies, I misread your post. I had tried using a download accelerator once and it failed. Have you tried downloading the full file and comparing its contents with those of the one your app downloads? I still think it might be useful to rename the file you get to .HTML and open it in your browser.
Cheers, Vikram.
The hands that help are holier than the lips that pray.