예제 #1
0
        public static void TestOperationsTimeElapsed(int maxItemsQuantity)
        {
            string searchTerm = CommandLine.RequestUserInput <string>("Search term: ");

            YouTubeAPIv3      api    = new YouTubeAPIv3();
            TimeElapsedResult result = api.TestOperationsTimeElapsed(maxItemsQuantity, searchTerm);

            CommandLine.WriteLine("\n");

            // Shows elapsed times for search list operation
            CommandLine.WriteLine("Search List Operation");
            CommandLine.WriteLine("----------------");
            Console.WriteLine(string.Format("Average: {0}", result.ElapsedSearch.Average()));
            Console.WriteLine(string.Format("Max: {0}", result.ElapsedSearch.Max()));
            CommandLine.WriteLine("\n");

            // Shows elapsed times for video list operation
            CommandLine.WriteLine("Video List Operation");
            CommandLine.WriteLine("----------------");
            Console.WriteLine(string.Format("Average: {0}", result.ElapsedVideo.Average()));
            Console.WriteLine(string.Format("Max: {0}", result.ElapsedVideo.Max()));
            CommandLine.WriteLine("\n");

            // Shows elapsed times for channel list operation
            CommandLine.WriteLine("Channel List Operation");
            CommandLine.WriteLine("----------------");
            Console.WriteLine(string.Format("Average: {0}", result.ElapsedChannel.Average()));
            Console.WriteLine(string.Format("Max: {0}", result.ElapsedChannel.Max()));
            CommandLine.WriteLine("\n");

            CommandLine.WriteLine(String.Format("Total Videos:{0}", result.Results.Count));

            CommandLine.PressAnyKeyToExit();
        }
예제 #2
0
        public static void CheckVideosDifferentRadius(string smallRadius, string bigRadius)
        {
            string searchTerm = CommandLine.RequestUserInput <string>("Search term: ");

            YouTubeAPIv3         api    = new YouTubeAPIv3();
            RadiusComparerResult result = api.CheckVideosDifferentRadius(smallRadius, bigRadius, searchTerm);

            CommandLine.WriteLine("\n");
            CommandLine.WriteLine(String.Format("Total Small Radius: {0}", result.SmallRadiusItems.Count));
            CommandLine.WriteLine(String.Format("Total Big Radius: {0}", result.BigRadiusItems.Count));
            CommandLine.WriteLine(String.Format("Total Elements in Small Radius that aren't in Big Radius: {0}", result.DifferentItems.Count));

            CommandLine.PressAnyKeyToExit();
        }
예제 #3
0
        public static void RetriveVideosUsingAPIKey()
        {
            string searchTerm = CommandLine.RequestUserInput <string>("Search term: ");

            YouTubeAPIv3        api     = new YouTubeAPIv3();
            List <SearchResult> results = api.RetriveVideosUsingAPIKey(searchTerm);

            CommandLine.WriteLine("\n");
            foreach (SearchResult searchResult in results)
            {
                CommandLine.WriteLine(searchResult.Snippet.Title.Replace("{", string.Empty).Replace("}", string.Empty) + " (" + searchResult.Id.VideoId + ")");
            }
            CommandLine.WriteLine(String.Format("Total:{0}", results.Count));

            CommandLine.PressAnyKeyToExit();
        }