Пример #1
0
        static async Task Main(string[] args)
        {
            var            builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
            IConfiguration config  = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();

            string sqlConnectionString      = config["SQLConnectionString"];
            string twitterConsumerKey       = config["TwitterConsumerKey"];
            string twitterConsumerSecret    = config["TwitterConsumerSecret"];
            string twitterAccessToken       = config["TwitterAccessToken"];
            string twitterAccessTokenSecret = config["TwitterAccessTokenSecret"];

            while (true)
            {
                Console.Write("Enter Text: ");
                string q = Console.ReadLine();
                //var tweets = await TrendLibrary.GetTweetsAsync(q, 10, twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret);
                var retval = await TrendLibrary.GetVaderAsync(q);

                Console.WriteLine($"({q}) Score: {retval}");
            }

            //string content = await TrendLibrary.LoadTweetVolumeAsync("Trump2019", twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret);
            //TrendLibrary.LoadUserTrends(sqlConnectionString, twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret, (err) => Console.WriteLine(err));
            TrendLibrary.LoadTrends(sqlConnectionString, twitterConsumerKey, twitterConsumerSecret, twitterAccessToken, twitterAccessTokenSecret, (err) => Console.WriteLine(err));
        }