Exemplo n.º 1
0
        /// <summary>
        /// Internal logic for the AutoRun-methods.
        /// </summary>
        private static async Task AutoRunInternal(string sloaderConfigPath, Dictionary <string, string> secrets)
        {
            var config =
                await
                SloaderConfig.Load(sloaderConfigPath, secrets);

            Trace.TraceInformation($"SloaderConfig loaded - init {nameof(SloaderRunner)}");

            var runner     = new SloaderRunner(config);
            var crawlerRun = await runner.RunAllCrawlers();

            await runner.RunThroughDrop(crawlerRun);
        }
Exemplo n.º 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());
        }