示例#1
0
        public async void StartSloader()
        {
            SloaderRunner = new SloaderRunner(SloaderConfigLoader.Parse(this.Input, new Dictionary <string, string>()));
            var result = await SloaderRunner.RunAllCrawlers();

            Output = result.ToJson();
        }
示例#2
0
        public static async Task <CrawlerRun> InvokeCrawler()
        {
#if DEBUG
            string debugYamlLocation =
                "https://raw.githubusercontent.com/Code-Inside/Sloader/master/src/Sloader.Web/App_Data/Sloader.yml";

            var config = await SloaderConfig.Load(debugYamlLocation, new Dictionary <string, string>());
#else
            var config =
                await
                SloaderConfig.Load(ConfigurationManager.AppSettings[ConfigKeys.SloaderConfigPath], new Dictionary <string, string>());
#endif

            var secrets = new SloaderSecrets();
            secrets.TwitterConsumerKey    = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerKey];
            secrets.TwitterConsumerSecret = ConfigurationManager.AppSettings[ConfigKeys.SecretTwitterConsumerSecret];
            var crawler = new SloaderRunner(config);

            return(await crawler.RunAllCrawlers());
        }