示例#1
0
        public void RenderVideoPage(String videoId)
        {
            Video video = api.GetVideo(videoId);

            Console.WriteLine("\n-------------------------------");
            Console.WriteLine("Video page (imagine fancy HTML)");
            Console.WriteLine("ID: " + video.Id);
            Console.WriteLine("Title: " + video.Title);
            Console.WriteLine("Video: " + video.Data);
            Console.WriteLine("-------------------------------\n");
        }
示例#2
0
        public Video GetVideo(string videoId)
        {
            Video video;

            if (!cacheAll.TryGetValue(videoId, out video))
            {
                video = youtubeService.GetVideo(videoId);
                cacheAll.Add(videoId, video);
            }
            else
            {
                Console.WriteLine("Retrieved video '" + videoId + "' from cache.");
            }
            return(video);
        }