I’m sure you all are aware of rapidshare. Most of the time these downloads links are spread across the website which makes it very difficult to get them. So, Instead of wasting time in downloading each link at a time, why not extract these links and store in some file ( may be text file ) and then use some script to do this dirty work.
Here is the C# code to extract from any url
HttpWebRequest request; HttpWebResponse response; Stream s; string strPath = Application.StartupPath + @"\Extract.txt"; TextWriter tsw = new StreamWriter(strPath, true); List<string> lst = new List<string>(); // create a request to the url request = (HttpWebRequest)WebRequest.Create("http://somewebsite.com"); // get the response response = (HttpWebResponse)request.GetResponse(); // get the stream of data and read into a string s = response.GetResponseStream(); string strContents = new StreamReader(s).ReadToEnd(); Regex r = new Regex("href\\s*=\\s*(?:(?:\\\"(?<url>[^\\\"]*)\\\")|(?>[^\\s]* ))"); MatchCollection mc1 = r.Matches(strContents); foreach (Match m1 in mc1) { Group grp = m1.Groups[1]; string strRSLink = grp.Value; strRSLink = Regex.Replace(strRSLink, @"(.*)(\.)(html)$", "$1", RegexOptions.IgnoreCase); if (Regex.IsMatch(strRSLink, @"http://rapidshare.com", RegexOptions.IgnoreCase)) { if (!lst.Exists(i => i.Equals(strRSLink))) lst.Add(strRSLink); } } foreach (var item in lst) { tsw.WriteLine(item); } tsw.Close();
And then you can use AutoIt scripting language to automate the download using any download manager. I’m using Internet download manager which is one of the best donwload manager tool.
AutoIt (and AutoItX) v3.3.0.0 released (24th December, 2008).AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying "runtimes" required! .
Just install it and use the following AutoIt script to automate the download. Here is the code
Local $program = @ProgramFilesDir & '\Internet Download Manager\IDMan.exe' Local $file = @DesktopDir & '\Autoit\RapidLinks.txt' Local $h_file Local $url Local $cnt = 0 $h_file = FileOpen($file, 0) If $h_file = -1 Then SetError(1) EndIf Run($program) While 1 $url = FileReadLine($h_file) If @error = -1 Then ExitLoop If $cnt = 2 Then Sleep(240000) $cnt = 0 EndIf ;MsgBox(0,"URL",$url) WinWait("Internet Download Manager 5.15") If Not WinActive("Internet Download Manager 5.15") Then _ WinActivate("Internet Download Manager 5.15") WinWaitActive("Internet Download Manager 5.15") Send("!ta") WinWait("Enter new address to download") If Not WinActive("Enter new address to download") Then _ WinActivate("Enter new address to download") WinWaitActive("Enter new address to download") Send($url) Send("!k") WinWait("Download File Info") If Not WinActive("Download File Info") Then _ WinActivate("Download File Info") WinWaitActive("Download File Info") Send("!s") $cnt += 1 Sleep(5000) WEnd FileClose($h_file)
Popularity: 4% [?]
December 27th, 2008
admin
Posted in
Tags:
I assumed it was likely being some unexciting old report, but it really compensated for my time. I most definitely will submit a link to this article on my web-site. I am convinced my site visitors are likely to get that basically useful.