Example #1
0
        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();
        }
Example #2
0
 public static void Run()
 {
     OOSpider.Create(new JsonFilePageModelPipeline("/data/webmagic"))
     .AddUrl("http://my.oschina.net/flashsword/blog").Run();
 }
Example #3
0
 public static void Run()
 {
     OOSpider.Create(Site.Me.SetSleepTime(100),
                     new ConsolePageModelPipeline <GithubRepoExample>());
 }
Example #4
0
        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();
        }