Ejemplo n.º 1
0
        void player_PlayBegin(YoutubePlaylistPlayer playlit, PlayListItem item)
        {
            try
            {
                //ClearLabels("NowPlaying");
                VideoInfo info = item.MusicTag as VideoInfo;
                if (info == null)
                {
                    return;
                }

                Log.Debug("YouTube.fm playback started");
                YouTubeEntry en = info.Entry;

                if (en.Authors.Count == 0)
                {
                    Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + Youtube2MP.GetVideoId(en));
                    try
                    {
                        Video video = Youtube2MP.request.Retrieve <Video>(videoEntryUrl);
                        en = video.YouTubeEntry;
                    }
                    catch (Exception)
                    {
                        //vid = null;
                    }
                }

                en.Title.Text = item.Description;
                item.FileName = Youtube2MP.StreamPlaybackUrl(en, info);
                ClearLabels("NowPlaying", true);
                ClearLabels("Next", true);
                Youtube2MP.NowPlayingEntry  = en;
                Youtube2MP.NextPlayingEntry = null;
                //ArtistManager.Instance.SetSkinProperties(Youtube2MP.NextPlayingEntry, "NowPlaying", false, false);
                if (playlit.GetNextItem() != null)
                {
                    VideoInfo nextinfo = playlit.GetNextItem().MusicTag as VideoInfo;
                    if (nextinfo != null)
                    {
                        Youtube2MP.NextPlayingEntry = nextinfo.Entry;
                        //ArtistManager.Instance.SetSkinProperties(Youtube2MP.NextPlayingEntry, "Next", false, false);
                    }
                }
                BackgroundWorker playBeginWorker = new BackgroundWorker();
                playBeginWorker.DoWork += playBeginWorker_DoWork;
                playBeginWorker.RunWorkerAsync();
                Youtube2MP.YouTubePlaying = true;
                GUIPropertyManager.SetProperty("#Youtube.fm.FullScreen.ShowTitle", "true");
                GUIPropertyManager.SetProperty("#Youtube.fm.FullScreen.ShowNextTitle",
                                               Youtube2MP.NextPlayingEntry != null ? "true" : "false");
                _labelTimer.Stop();
                _labelTimer.Start();
            }
            catch (Exception exception)
            {
                Log.Error("Youtube play begin exception");
                Log.Error(exception);
            }
        }
Ejemplo n.º 2
0
        public void NowPlaying(YouTubeEntry song)
        {
            if (!IsLoged)
            {
                return;
            }
            try
            {
                string Artist = string.Empty;
                string Title  = string.Empty;
                int    length = 0;
                string _title = song.Title.Text;
                if (_title.Contains("-"))
                {
                    Artist = _title.Split('-')[0].Trim();
                    Title  = _title.Split('-')[1].Trim();
                }
                if (song.Duration != null && song.Duration.Seconds != null)
                {
                    length = Convert.ToInt32(song.Duration.Seconds, 10);
                }

                if (!string.IsNullOrEmpty(Artist) && !string.IsNullOrEmpty(Title) && length > 0)
                {
                    NowplayingTrack track1 = new NowplayingTrack(Artist, Title, new TimeSpan(0, 0, length));
                    manager.ReportNowplaying(track1);
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }
Ejemplo n.º 3
0
        public void Submit(YouTubeEntry song)
        {
            if (!IsLoged)
            {
                return;
            }
            try
            {
                string Artist = string.Empty;
                string Title  = string.Empty;
                int    length = 0;
                string _title = song.Title.Text;
                if (_title.Contains("-"))
                {
                    Artist = _title.Split('-')[0].Trim();
                    Title  = _title.Split('-')[1].Trim();
                }
                if (song.Duration != null && song.Duration.Seconds != null)
                {
                    length = Convert.ToInt32(song.Duration.Seconds, 10);
                }

                if (!string.IsNullOrEmpty(Artist) && !string.IsNullOrEmpty(Title) && length > 0)
                {
                    Entry entry = new Entry(Artist, Title, DateTime.Now, PlaybackSource.User, new TimeSpan(0, 0, length), ScrobbleMode.Played);
                    manager.Queue(entry);
                    //manager.Submit();
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }
        public ArtistItem GetArtist(YouTubeEntry entry)
        {
            ArtistItem      artistItem  = new ArtistItem();
            string          lsSQL       = string.Format("select distinct ARTIST_ID from VIDEOS WHERE VIDEO_ID=\"{0}\" ", Youtube2MP.GetVideoId(entry));
            SQLiteResultSet loResultSet = m_db.Execute(lsSQL);

            for (int iRow = 0; iRow < loResultSet.Rows.Count; iRow++)
            {
                artistItem = ArtistManager.Instance.GetArtistsById(DatabaseUtility.Get(loResultSet, iRow, "ARTIST_ID"));
                break;
            }
            if (string.IsNullOrEmpty(artistItem.Name))
            {
                artistItem.Name = ArtistManager.Instance.GetArtistName(entry.Title.Text);
            }
            ArtistItem artistItemLocal = GetArtistsByName(artistItem.Name);

            if (artistItemLocal != null)
            {
                artistItem.Bio     = artistItemLocal.Bio;
                artistItem.Id      = string.IsNullOrEmpty(artistItem.Id) ? artistItemLocal.Id : artistItem.Id;
                artistItem.Img_url = !string.IsNullOrEmpty(artistItemLocal.Img_url) ? artistItemLocal.Img_url : artistItem.Img_url;
                artistItem.Name    = string.IsNullOrEmpty(artistItem.Name) ? artistItemLocal.Name : artistItem.Name;
                artistItem.Tags    = string.IsNullOrEmpty(artistItem.Tags) ? artistItemLocal.Tags : artistItem.Tags;
                artistItem.User    = string.IsNullOrEmpty(artistItem.User) ? artistItemLocal.User : artistItem.User;
            }
            return(artistItem);
        }
        public static string PlaybackUrl(YouTubeEntry vid)
        {
            string PlayblackUrl = "";

            PlayblackUrl = vid.Id.AbsoluteUri;
            return(PlayblackUrl);
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            Uri          ur    = new Uri("http://gdata.youtube.com/feeds/api/videos/fSgGV1llVHM&f=gdata_playlists&c=ytapi-DukaIstvan-MyYouTubeVideosF-d1ogtvf7-0&d=U1YkMvELc_arPNsH4kYosmD9LlbsOl3qUImVMV6ramM");
            YouTubeQuery query = new YouTubeQuery("http://gdata.youtube.com/feeds/api/channels?q=vevo");



            YouTubeFeed  videoFeed = service.Query(query);
            YouTubeEntry en        = (YouTubeEntry)videoFeed.Entries[0];

            Video          video    = request.Retrieve <Video>(new Uri("http://gdata.youtube.com/feeds/api/videos/" + en.VideoId));
            Feed <Comment> comments = request.GetComments(video);
            string         cm       = "";

            foreach (Comment c in comments.Entries)
            {
                cm += c.Content + "\n------------------------------------------\n";
            }

            VideoInfo info = new VideoInfo();

            info.Get("yUHNUjEs7rQ");
            //Video v = request.Retrieve<Video>(videoEntryUrl);



            //Feed<Comment> comments = request.GetComments(v);

            //string cm = "";
            //foreach (Comment c in comments.Entries)
            //{
            //  cm += c.Author + c.Content + "------------------------------------------";
            //}
        }
        public void Save(YouTubeEntry entry)
        {
            try
            {
                string          id          = Youtube2MP.GetVideoId(entry);
                string          lsSQL       = string.Format("select distinct VIDEO_ID from VIDEOS WHERE VIDEO_ID=\"{0}\"", id);
                SQLiteResultSet loResultSet = m_db.Execute(lsSQL);
                if (loResultSet.Rows.Count == 0)
                {
                    int duration = 0;
                    if (entry.Duration != null && entry.Duration.Seconds != null)
                    {
                        duration = Convert.ToInt32(entry.Duration.Seconds);
                    }
                    bool ishd =
                        entry.ExtensionElements.Any(
                            extensionElementFactory =>
                            extensionElementFactory.XmlPrefix == "yt" && extensionElementFactory.XmlName == "hd");

                    lsSQL =
                        string.Format(
                            "insert into VIDEOS (VIDEO_ID,TITLE ,LENGTH,IMG_URL, hd ) VALUES (\"{0}\",\"{1}\",{2},\"{3}\",{4})",
                            Youtube2MP.GetVideoId(entry),
                            DatabaseUtility.RemoveInvalidChars(entry.Title.Text.Replace('"', '`')),
                            duration,
                            YoutubeGUIBase.GetBestUrl(entry.Media.Thumbnails),
                            ishd ? 1 : 0);
                    m_db.Execute(lsSQL);
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }
Ejemplo n.º 8
0
 protected void LoadRelatated(YouTubeEntry entry)
 {
     try
     {
         //Youtube2MP.getIDSimple(Youtube2MP.NowPlayingEntry.Id.AbsoluteUri));
         //GUIControl.ClearControl(GetID, listControl.GetID);
         string relatatedUrl = string.Format("http://gdata.youtube.com/feeds/api/videos/{0}/related",
                                             Youtube2MP.GetVideoId(entry));
         relatated.Clear();
         YouTubeQuery query = new YouTubeQuery(relatatedUrl);
         YouTubeFeed  vidr  = Youtube2MP.service.Query(query);
         // time to time this query return nothing, maybe the quata limit ..
         if (vidr.Entries.Count == 0)
         {
             vidr = Youtube2MP.service.Query(query);
         }
         if (vidr.Entries.Count > 0)
         {
             addVideos(vidr, query);
         }
         if (listControl != null)
         {
             FillRelatedList();
         }
     }
     catch (Exception exception)
     {
         Log.Debug("[YouTube.Fm]Error {0}\n{1}", exception.Message, exception.StackTrace);
     }
 }
Ejemplo n.º 9
0
        void player_PlayBegin(PlayListItem item)
        {
            try
            {
                ClearLabels("NowPlaying");
                VideoInfo info = item.MusicTag as VideoInfo;
                if (info == null)
                {
                    return;
                }

                Log.Debug("YouTube.fm playback started");
                YouTubeEntry en = info.Entry;
                item.FileName = Youtube2MP.StreamPlaybackUrl(en, info);
                Song song = Youtube2MP.YoutubeEntry2Song(en);

                Youtube2MP.NowPlayingEntry = en;
                Youtube2MP.NowPlayingSong  = song;
                SetLabels(en, "NowPlaying");
                if (listControl != null)
                {
                    GUIControl.ClearControl(GetID, listControl.GetID);
                    relatated.Clear();
                }
                infoTimer.Enabled = true;
            }
            catch
            {
            }
        }
        protected ArtistItem GetArtist(YouTubeEntry entry)
        {
            ArtistItem artistItem = DatabaseProvider.InstanInstance.GetArtist(entry);

            if (artistItem != null)
            {
                return(artistItem);
            }
            string vidId = Youtube2MP.GetVideoId(entry);

            artistItem = ArtistManager.Instance.SitesCache.GetByVideoId(vidId) != null
                                ? ArtistManager.Instance.Grabber.GetFromVideoSite(
                ArtistManager.Instance.SitesCache.GetByVideoId(vidId).SIte)
                                : ArtistManager.Instance.Grabber.GetFromVideoId(vidId);

            if (string.IsNullOrEmpty(artistItem.Id) && entry.Title.Text.Contains("-"))
            {
                artistItem =
                    ArtistManager.Instance.GetArtistsByName(entry.Title.Text.Split('-')[0].TrimEnd());
            }

            if (!string.IsNullOrEmpty(artistItem.Id))
            {
                ArtistManager.Instance.Save(artistItem);
                DatabaseProvider.InstanInstance.Save(entry, artistItem);
            }
            return(artistItem);
        }
        public void PlayNext(YouTubeEntry entry)
        {
            PlayList playlist = null;
            int      poz      = 0;

            if (Youtube2MP.temp_player.CurrentSong > -1)
            {
                poz      = Youtube2MP.temp_player.CurrentSong;
                playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO);
            }
            if (Youtube2MP.player.CurrentSong > -1)
            {
                poz      = Youtube2MP.player.CurrentSong;
                playlist = Youtube2MP.player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO);
            }
            if (playlist == null)
            {
                return;
            }
            GUIWaitCursor.Hide();
            VideoInfo qa = SelectQuality(entry);

            if (qa.Quality == VideoQuality.Unknow)
            {
                return;
            }
            GUIWaitCursor.Show();
            AddItemToPlayList(entry, ref playlist, qa, poz);
        }
Ejemplo n.º 12
0
        public YoutubeVideo GetVideoById(string videoId)
        {
            YouTubeService service = new YouTubeService(_applicationName, _developerKey);
            string         url     = String.Format("{0}/{1}?v=2&", _videoUrl, videoId);

            YouTubeQuery searchQuery = new YouTubeQuery(url);

            var          result = service.Query(searchQuery);
            YouTubeEntry entry  = result.Entries.FirstOrDefault() as YouTubeEntry;

            var video = entry.ToYoutubeVideo();

            string commentUrl = String.Format("http://gdata.youtube.com/feeds/api/videos/{0}/comments?max-results={1}&start-index={2}", videoId, 50, 1);

            var            youTubeRequestSettings = new YouTubeRequestSettings(_applicationName, _developerKey);
            var            request  = new YouTubeRequest(youTubeRequestSettings);
            Feed <Comment> comments = request.Get <Comment>(new Uri(commentUrl));

            foreach (var item in comments.Entries)
            {
                video.Comments.Add(new YoutubeComment
                {
                    Author    = item.Author,
                    UpdatedOn = item.Updated,
                    Title     = item.Title,
                    Content   = item.Content,
                });
            }

            return(video);
        }
        public override void Play(SearchResultItem resultItem)
        {
            YouTubeEntry entry = resultItem.MetaData["entry"] as YouTubeEntry;

            YoutubeGUIBase.SetLabels(entry, "NowPlaying");
            Youtube2MP.NowPlayingEntry = entry;
            VideoInfo info = new VideoInfo();

            g_Player.PlayVideoStream(Youtube2MP.StreamPlaybackUrl(entry, info));
            if (g_Player.Playing)
            {
                if (Youtube2MP._settings.ShowNowPlaying)
                {
                    GUIWindowManager.ActivateWindow(29052);
                }
                else
                {
                    g_Player.ShowFullScreenWindow();
                }
            }

            if (!g_Player.Playing)
            {
                GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                if (dlgOK != null)
                {
                    dlgOK.SetHeading(25660);
                    dlgOK.SetLine(1, "Unable to playback the item ! ");
                    dlgOK.SetLine(2, "");
                    dlgOK.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
        }
Ejemplo n.º 14
0
        internal virtual YouTubeBaseEntry CreateYouTubeBaseEntry()
        {
            // TODO: Instantiate an appropriate concrete class.
            YouTubeBaseEntry target = new YouTubeEntry();

            return(target);
        }
 public static string GetVideoId(YouTubeEntry vid)
 {
     if (!String.IsNullOrEmpty(vid.VideoId))
     {
         return(vid.VideoId);
     }
     return(getIDSimple(vid.Id.AbsoluteUri));
 }
Ejemplo n.º 16
0
 protected void removeFromPlaylist(VideoInfo video, string playlistUri)
 {
     if (CheckUsernameAndPassword())
     {
         Login();
         YouTubeEntry entry = ((MyYouTubeEntry)video.Other).YouTubeEntry;
         service.Delete(entry);
     }
 }
Ejemplo n.º 17
0
 protected void addFavorite(VideoInfo video)
 {
     if (CheckUsernameAndPassword())
     {
         Login();
         YouTubeEntry entry = ((MyYouTubeEntry)video.Other).YouTubeEntry;
         service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(accountname)), entry);
     }
 }
Ejemplo n.º 18
0
        public void CreateFeedEntryTest()
        {
            Uri          uriBase  = null;                               // TODO: Initialize to an appropriate value
            IService     iService = null;                               // TODO: Initialize to an appropriate value
            YouTubeFeed  target   = new YouTubeFeed(uriBase, iService); // TODO: Initialize to an appropriate value
            YouTubeEntry entry    = target.CreateFeedEntry() as YouTubeEntry;

            Assert.IsNotNull(entry);
        }
Ejemplo n.º 19
0
 protected void addToPlaylist(VideoInfo video, string playlistUri)
 {
     if (CheckUsernameAndPassword())
     {
         Login();
         YouTubeEntry entry = ((MyYouTubeEntry)video.Other).YouTubeEntry;
         service.Insert(playlistUri, entry);
     }
 }
Ejemplo n.º 20
0
        public async Task ProcessRecording(string recordingPath)
        {
            try
            {
                var recording = new FileInfo(recordingPath);
                var entryFile = recording.Directory.GetFiles("*.json", SearchOption.TopDirectoryOnly).FirstOrDefault(file => file.Name.Equals(settings.YouTube.EntryFileName, StringComparison.OrdinalIgnoreCase));

                if (entryFile != null && entryFile.Exists)
                {
                    YouTubeEntry entry = JsonSerializer.Deserialize <YouTubeEntry>(await File.ReadAllTextAsync(entryFile.FullName));

                    UserCredential credential;

                    using (var stream = new FileStream(Path.Combine(settings.Location.DataDirectory, "client_secrets.json"), FileMode.Open, FileAccess.Read))
                    {
                        credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, new[] { YouTubeService.Scope.YoutubeUpload }, settings.YouTube.ChannelId, CancellationToken.None);
                    }

                    var youtubeService = new YouTubeService(new BaseClientService.Initializer()
                    {
                        HttpClientInitializer = credential,
                        ApiKey          = settings.YouTube.ApiKey,
                        ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
                    });

                    using (youtubeService)
                    {
                        var video = new Video
                        {
                            Snippet = new VideoSnippet
                            {
                                Title       = entry.Title,
                                Description = string.Join(Environment.NewLine, entry.DescriptionLines),
                                Tags        = entry.Tags,
                                CategoryId  = entry.CategoryId
                            },
                            Status = new VideoStatus
                            {
                                PrivacyStatus = entry.PrivacyStatus
                            }
                        };

                        using (var fileStream = recording.OpenRead())
                        {
                            var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");
                            videosInsertRequest.ProgressChanged  += videosInsertRequest_ProgressChanged;
                            videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
                            await videosInsertRequest.UploadAsync(cancellationTokenSource.Token);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogError(e, $"Could not upload {recordingPath}");
            }
        }
        public void LocationTest()
        {
            YouTubeEntry target   = new YouTubeEntry(); // TODO: Initialize to an appropriate value
            GeoRssWhere  expected = new GeoRssWhere(10, 11);
            GeoRssWhere  actual;

            target.Location = expected;
            actual          = target.Location;
            Assert.AreEqual(expected, actual);
        }
        public void MediaTest()
        {
            YouTubeEntry target = new YouTubeEntry(); // TODO: Initialize to an appropriate value

            GData.YouTube.MediaGroup expected = new GData.YouTube.MediaGroup();
            GData.YouTube.MediaGroup actual;
            target.Media = expected;
            actual       = target.Media;
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 23
0
        void item_OnRetrieveArt(GUIListItem item)
        {
            YouTubeEntry entry     = item.MusicTag as YouTubeEntry;
            string       imageFile = Youtube2MP.GetLocalImageFileName(GetBestUrl(entry.Media.Thumbnails));

            if (File.Exists(imageFile))
            {
                item.ThumbnailImage = imageFile;
                item.IconImage      = imageFile;
                item.IconImageBig   = imageFile;
            }
        }
        /// <summary>
        /// uploads or inserts a new video for a given user.
        /// </summary>
        /// <param name="userName">if this is null the default authenticated user will be used</param>
        /// <param name="v">the created video to be used</param>
        /// <returns></returns>
        public Video Upload(string userName, Video v)
        {
            Video        rv = null;
            YouTubeEntry e  = this.Service.Upload(userName, v.YouTubeEntry);

            if (e != null)
            {
                rv           = new Video();
                rv.AtomEntry = e;
            }
            return(rv);
        }
 public void Submit(YouTubeEntry song)
 {
     try
     {
         Lastfm.Scrobbling.Entry track = new Lastfm.Scrobbling.Entry("madonna", "test", DateTime.Now, Lastfm.Scrobbling.PlaybackSource.User, new TimeSpan(0, 2, 32), Lastfm.Scrobbling.ScrobbleMode.Played);
         manager.Queue(track);
         //manager.Submit();
     }
     catch
     {
     }
 }
        private void item_OnItemSelected(GUIListItem item, GUIControl parent)
        {
            YouTubeEntry vid = item.MusicTag as YouTubeEntry;

            if (vid != null)
            {
                SetLabels(vid, "Curent");
            }
            else
            {
                ClearLabels("Curent");;
            }
        }
 public void NowPlaying(YouTubeEntry song)
 {
     try
     {
         Lastfm.Scrobbling.NowplayingTrack track = new Lastfm.Scrobbling.NowplayingTrack("madonna", "test");
         track.Album    = "valami";
         track.Duration = new TimeSpan(0, 3, 22);
         manager.ReportNowplaying(track);
     }
     catch
     {
     }
 }
        public void DoPlay(YouTubeEntry vid, bool fullscr, GUIListControl facade)
        {
            if (vid != null)
            {
                VideoInfo qa = SelectQuality(vid);
                if (qa.Quality == VideoQuality.Unknow)
                {
                    return;
                }
                Youtube2MP.temp_player.Reset();
                Youtube2MP.temp_player.RepeatPlaylist = true;

                Youtube2MP.temp_player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC_VIDEO;
                PlayList playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO);
                playlist.Clear();
                g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped);
                AddItemToPlayList(vid, ref playlist, qa);

                if (facade != null)
                {
                    qa.Items = new Dictionary <string, string>();
                    int selected = facade.SelectedListItemIndex;
                    for (int i = selected + 1; i < facade.ListItems.Count; i++)
                    {
                        AddItemToPlayList(facade.ListItems[i], ref playlist, new VideoInfo(qa));
                    }
                }

                PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE;
                Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE;
                Youtube2MP.temp_player.Play(0);


                if (g_Player.Playing && fullscr)
                {
                    if (_setting.ShowNowPlaying)
                    {
                        GUIWindowManager.ActivateWindow(29052);
                    }
                    else
                    {
                        g_Player.ShowFullScreenWindow();
                    }
                }

                if (!g_Player.Playing)
                {
                    Err_message("Unable to playback the item ! ");
                }
            }
        }
Ejemplo n.º 29
0
 protected void rateVideo(VideoInfo video, byte rating)
 {
     if (CheckUsernameAndPassword())
     {
         Login();
         YouTubeEntry entry = ((MyYouTubeEntry)video.Other).YouTubeEntry;
         Video        v     = new Video()
         {
             AtomEntry = entry
         };
         v.Rating = rating;
         request.Insert(v.RatingsUri, v);
     }
 }
Ejemplo n.º 30
0
        private void button1_Click(object sender, EventArgs e)
        {
            Uri ur =
                new Uri(
                    "http://gdata.youtube.com/feeds/api/videos/fSgGV1llVHM&f=gdata_playlists&c=ytapi-DukaIstvan-MyYouTubeVideosF-d1ogtvf7-0&d=U1YkMvELc_arPNsH4kYosmD9LlbsOl3qUImVMV6ramM");
            YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);

            //order results by the number of views (most viewed first)
            query.OrderBy = "viewCount";

            //exclude restricted content from the search
            query.SafeSearch = YouTubeQuery.SafeSearchValues.None;
            //string ss = YouTubeQuery.TopRatedVideo;
            //http://gdata.youtube.com/feeds/api/standardfeeds/top_rated
            //search for puppies!
            query.Query = textBox1.Text;
            query.Categories.Add(new QueryCategory("Music", QueryCategoryOperator.AND));

            YouTubeFeed  videoFeed = service.Query(query);
            YouTubeEntry en        = (YouTubeEntry)videoFeed.Entries[0];
            string       s         = en.Summary.Text;
            string       s1        = en.Media.Description.Value;

            Google.GData.YouTube.MediaGroup gr = en.Media;

            Uri            videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + en.VideoId);
            Video          video         = request.Retrieve <Video>(videoEntryUrl);
            Feed <Comment> comments      = request.GetComments(video);
            string         cm            = "";

            foreach (Comment c in comments.Entries)
            {
                cm += c.Content + "\n------------------------------------------\n";
            }

            VideoInfo info = new VideoInfo();

            info.Get("yUHNUjEs7rQ");
            //Video v = request.Retrieve<Video>(videoEntryUrl);



            //Feed<Comment> comments = request.GetComments(v);

            //string cm = "";
            //foreach (Comment c in comments.Entries)
            //{
            //  cm += c.Author + c.Content + "------------------------------------------";
            //}
        }