static void doSpider(string[] args) { int n_threads = 0; int n_ms_timeout = 0; string root_url = ""; string start_url = ""; try { n_threads = Int32.Parse(args[0]); n_ms_timeout = Int32.Parse(args[1]); root_url = args[2]; if (args.Length > 3) { start_url = args[3]; } else { start_url = root_url; } } catch (Exception e) { System.Console.WriteLine("ERROR: " + e.Message); System.Console.WriteLine("run 'SpiderConsoleApp.exe help' for help."); Environment.Exit(1); // Java: System.exit(1); } Spider.Spider s = new Spider.Spider(root_url, start_url, n_ms_timeout, n_threads); // Run the spider and wait for results s.spider(); List<SpiderPage> results = waitForResults(s); printResults(results); }
static void doSpider(string[] args) { int n_threads = 0; int n_ms_timeout = 0; string root_url = ""; string start_url = ""; try { n_threads = Int32.Parse(args[0]); n_ms_timeout = Int32.Parse(args[1]); root_url = args[2]; if (args.Length > 3) { start_url = args[3]; } else { start_url = root_url; } } catch (Exception e) { System.Console.WriteLine("ERROR: " + e.Message); System.Console.WriteLine("run 'SpiderConsoleApp.exe help' for help."); Environment.Exit(1); // Java: System.exit(1); } Spider.Spider s = new Spider.Spider(root_url, start_url, n_ms_timeout, n_threads); // Run the spider and wait for results s.spider(); List <SpiderPage> results = waitForResults(s); printResults(results); }
static void Main(string[] args) { string startUrl = "http://www.ideaeng.com/"; string baseUrl = "http://www.ideaeng.com"; Spider.Spider s = new Spider.Spider(startUrl, baseUrl, 500, 10); s.spider(); List <SpiderPage> results = null; do { results = s.getResults(); } while (results == null); for (int i = 0; i < results.Count; i++) { SpiderPage curr = results.ElementAt(i); List <string> curr_aliases = curr.getAliasUrls(); List <string> curr_links = curr.getLinkingToUrls(); List <string> curr_refs = curr.getReferencedByUrls(); System.Console.WriteLine("\t" + curr.getUrl() + " has " + curr_links.Count + " alias(es):"); for (int q = 0; q < curr_links.Count; q++) { System.Console.WriteLine("\t\t" + curr_aliases.ElementAt(q)); } System.Console.WriteLine("\t" + curr.getUrl() + " links to " + curr_links.Count + " page(s):"); for (int k = 0; k < curr_links.Count; k++) { System.Console.WriteLine("\t\t" + curr_links.ElementAt(k)); } System.Console.WriteLine("\t" + curr.getUrl() + " is referred to by " + curr_refs.Count + " page(s):"); for (int g = 0; g < curr_refs.Count; g++) { System.Console.WriteLine("\t\t" + curr_refs.ElementAt(g)); } System.Console.WriteLine("------------------------------------------------------------------------------------"); } }
static void Main(string[] args) { string startUrl = "http://www.ideaeng.com/"; string baseUrl = "http://www.ideaeng.com"; Spider.Spider s = new Spider.Spider(startUrl, baseUrl, 500, 10); s.spider(); List<SpiderPage> results = null; do { results = s.getResults(); } while (results == null); for (int i = 0; i < results.Count; i++) { SpiderPage curr = results.ElementAt(i); List<string> curr_aliases = curr.getAliasUrls(); List<string> curr_links = curr.getLinkingToUrls(); List<string> curr_refs = curr.getReferencedByUrls(); System.Console.WriteLine("\t" + curr.getUrl() + " has " + curr_links.Count + " alias(es):"); for (int q = 0; q < curr_links.Count; q++) { System.Console.WriteLine("\t\t" + curr_aliases.ElementAt(q)); } System.Console.WriteLine("\t" + curr.getUrl() + " links to " + curr_links.Count + " page(s):"); for (int k = 0; k < curr_links.Count; k++) { System.Console.WriteLine("\t\t" + curr_links.ElementAt(k)); } System.Console.WriteLine("\t" + curr.getUrl() + " is referred to by " + curr_refs.Count + " page(s):"); for (int g = 0; g < curr_refs.Count; g++) { System.Console.WriteLine("\t\t" + curr_refs.ElementAt(g)); } System.Console.WriteLine("------------------------------------------------------------------------------------"); } }