public static void Run() { var ooSpider = OOSpider.Create <BaiduBaikeExample>(); //single download var urlTemplate = "http://baike.baidu.com/search/word?word=%s&pic=1&sug=1&enc=utf8"; var baike = ooSpider.Get <BaiduBaikeExample>("http://baike.baidu.com/search/word?word=httpclient&pic=1&sug=1&enc=utf8"); Console.WriteLine(baike); //multidownload var list = new List <string> { string.Format(urlTemplate, "风力发电"), string.Format(urlTemplate, "太阳能"), string.Format(urlTemplate, "地热发电"), string.Format(urlTemplate, "地热发电") }; var resultItemses = ooSpider.GetAll <BaiduBaikeExample>(list); foreach (var item in resultItemses) { Console.WriteLine(item.ToString()); } ooSpider.Close(); }
public static void Run() { OOSpider.Create(new JsonFilePageModelPipeline("/data/webmagic")) .AddUrl("http://my.oschina.net/flashsword/blog").Run(); }
public static void Run() { OOSpider.Create(Site.Me.SetSleepTime(100), new ConsolePageModelPipeline <GithubRepoExample>()); }
public static void Run() { var spider = OOSpider.Create(Site.Me.SetSleepTime(100), new ConsolePageModelPipeline <GithubRepoApiExample>()); spider.AddUrl("https://api.github.com/repos/code4craft/webmagic").Run(); }