Esempio n. 1
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (musiclist.SelectedItems.Count == 1)
         {
             if (ShowPopular == false)
             {
                 this.Enabled = false;
                 DownloadFromYoutube(musiclist.SelectedItems[0].Name);
                 this.Enabled = true;
                 metroTabControl1.SelectedIndex = 1;
             }
             else
             {
                 var    items        = new VideoSearch();
                 int    index        = 0;
                 bool   found        = false;
                 string youtubeUrl   = "";
                 string youtubeTitle = "";
                 while (!found)
                 {
                     youtubeUrl   = items.SearchQuery(musiclist.SelectedItems[0].Text, 1)[index].Url;
                     youtubeTitle = items.SearchQuery(musiclist.SelectedItems[0].Text, 1)[index].Title.Trim();
                     if (youtubeTitle.Contains("MUSIC BANK") || youtubeTitle.Contains("MusicBank") || youtubeTitle.Contains("음악중심") || youtubeTitle.Contains("음중") || youtubeTitle.Contains("뮤직뱅크") || youtubeTitle.Contains("뮤뱅") || youtubeTitle.Contains("라이브") || youtubeTitle.Contains("Live") || youtubeTitle.Contains("TJ노래방") || youtubeTitle.Contains("Karaoke") || youtubeTitle.Contains("1시간") || youtubeTitle.Contains("1h") || youtubeTitle.Contains("1Hour") || youtubeTitle.Contains("1hour"))
                     {
                         index++;
                     }
                     else
                     {
                         found = true;
                     }
                 }
                 this.Enabled = false;
                 DownloadFromYoutube(youtubeUrl);
                 this.Enabled = true;
                 metroTabControl1.SelectedIndex = 1;
             }
         }
         else
         {
             MessageBox.Show("곡을 한개만 선택해주세요.");
         }
     }
     catch
     {
         MessageBox.Show("오류 발생 프로그램을 종료합니다.");
         Process.GetCurrentProcess().Kill();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Gets a song from a user and plays it
        /// </summary>
        /// <param name="guild"></param>
        /// <param name="channel"></param>
        /// <param name="path">The path to the song (youtube url)</param>
        /// <param name="author">The person requesting the song</param>
        /// <returns></returns>
        public async Task SendLinkAsync(IGuild guild, IMessageChannel channel, string path, IUser author)
        {
            if (ConnectedChannels.TryGetValue(guild.Id, out client))
            {
                Tuple <string, string, string, string, IUser> VideoData = null;

                var items = new VideoSearch();

                var item = items.SearchQuery(path, 1)[0];

                VideoData = new Tuple <string, string, string, string, IUser>(path, item.Title, item.Duration, item.Thumbnail, author);

                queue.Enqueue(VideoData);
                if (songPlaying)
                {
                    await channel.SendMessageAsync($"{VideoData.Item2} has been added to the queue");

                    if (queue.Count == 1)
                    {
                        PlaySong(channel);
                    }
                }
                else
                {
                    songPlaying = true;
                    isSongPlaying.SetResult(true);
                    PlaySong(channel);
                }
            }
        }
Esempio n. 3
0
        private void doSearch()
        {
            panelContent.Controls.Clear();
            home.Clear();
            VideoSearch vs = new VideoSearch();

            foreach (var item in vs.SearchQuery(txtBoxSearch.Text, 1))
            {
                Button b = new Button();
                b.Width             = 340;
                b.Height            = 356;
                b.TextImageRelation = TextImageRelation.TextAboveImage;
                b.Text      = item.Title;
                b.ForeColor = Color.White;
                b.Font      = new Font("Century Gothic", 18);
                byte[] imgBytes = new WebClient().DownloadData(item.Thumbnail);
                using (MemoryStream ms = new MemoryStream(imgBytes))
                {
                    b.Image = Image.FromStream(ms);
                }
                dict.Add(b, item.Url);
                b.Click += new EventHandler(videoClick);
                panelContent.Controls.Add(b);
                home.Add(b);
            }
        }
Esempio n. 4
0
        /*
         *  The main function. Basicly it shows the unicode logo I made, and ask user for a video title, that will be searched on YouTube.
         *  The function show all videos detected on 1st page and ask user if 1st result is correct.
         *  If not, the app will show user whole list of found videos, and asks for selecting the correct one
         *  (or entering new phrase if searched video is not on the list).
         *  When user confirm any of results, the program will show all available info, and let user download it.
         */

        ///<summary>The main function asks user for a phrase and let him or her, select the correct result and then gives some options to do with it.</summary>
        static void Main()
        {
            Console.Clear();
            Console.WriteLine(logo);
            Console.WriteLine("Enter title of the video you want to peek:");
            string videoName = Console.ReadLine();

            try
            {
                VideoSearch             items = new VideoSearch();
                List <VideoInformation> list  = items.SearchQuery(videoName, pagesToCheck);
                Console.WriteLine("Did you mean: " + list[0].Title + "?");
                if (Confirm())
                {
                    ShowAllInfo(list[0], true);
                }
                else
                {
                    SelectVideo(list, true);
                }
            }
            catch (System.Net.WebException)
            {
                Console.WriteLine("Connection error.\nCheck your internet connection and press any key to try again.");
                Console.ReadKey();
                Main();
            }
        }
        public async Task <IActionResult> Details(int movieScheduleId)
        {
            var model = new MovieDetailsModel
            {
                Movie = _movieScheduleRepository.Find(movieScheduleId)
            };

            var imdbData = await _imdbService.GetMovie(model.Movie.Movie.ImdbId);

            if (!string.IsNullOrEmpty(imdbData.Error))
            {
                return(RedirectToAction("Error", "Public"));
            }

            model.Rate        = float.Parse(imdbData.ImdbRating);
            model.Categories  = imdbData.Genre.Split(',');
            model.Duration    = TimeSpan.FromMinutes(int.Parse(imdbData.RunTime.Replace("min", string.Empty).Trim()));
            model.ImageSource = imdbData.Poster;
            model.Reviews     = model.Movie.Movie.Reviews.OrderByDescending(mr => mr.CreatedAt).ToArray();

            var searcher = new VideoSearch();

            var video = searcher.SearchQuery(model.Movie.Movie.Name, 1).FirstOrDefault();

            if (video != null)
            {
                model.Trailer = TransformUrlToEmbed(video.Url);
            }

            return(View(model));
        }
Esempio n. 6
0
 private void buscarButton_Click(object sender, EventArgs e)
 {
     try
     {
         VideoSearch items = new VideoSearch();
         //Lista de la clase video
         List <Video> list = new List <Video>();
         // Por cada video que resulte de la busqueda, lo agregamos a la lista videos
         // Para despues pasarlo al datagrid.
         foreach (var item in items.SearchQuery(searchTextBox.Text, 1))
         {
             Video video = new Video();
             video.Titulo = item.Title;
             video.Autor  = item.Author;
             video.Url    = item.Url;
             byte[] ImagenBytes = new WebClient().DownloadData(item.Thumbnail);
             using (MemoryStream ms = new MemoryStream(ImagenBytes))
             {
                 video.Thumbnail = Image.FromStream(ms);
             }
             list.Add(video);
         }
         videoBindingSource.DataSource = list;
         searchTextBox.Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message.ToString());
     }
 }
Esempio n. 7
0
        public void SearchMethod(string msg)
        {
            // Переменная колличества страниц результатов поиска
            int pages = 1;

            // Инициализация класса поиска видео
            var response = new VideoSearch();

            // Цикл вывода результата поиска
            foreach (var result in response.SearchQuery(msg, pages))
            {
                //Получение ID видео
                var id = result.Url.Substring(result.Url.LastIndexOf('=') + 1);
                // Получение ссылки на просмотр в режиме полного экрана
                var link = "https://www.youtube.com/embed/" + result.Url.Substring(result.Url.LastIndexOf('=') + 1);

                //Добавление названий и ссылок на видео с youtube в конечную коллекцию с результатами
                MainWindow.Self.lsbVideos.Dispatcher.Invoke(() => videos.Add(new Tbot()
                {
                    Name = result.Title,
                    Link = link,
                    Id   = id
                }));
            }
        }
Esempio n. 8
0
        private void SaveSong(string songBefore)
        {
            YoutubeLink = videoSearch.SearchQuery(songBefore, 1).FirstOrDefault().Url;
            if (!String.IsNullOrEmpty(songBefore))
            {
                // extract songtitle from metadata header. Trim was needed, because some stations don't trim the songtitle

                Song songsearched = Songs.Where(x => x.Songname == songBefore).FirstOrDefault();
                if (songsearched == null)
                {
                    // Keyword


                    var song = new Song();

                    song.Songname     = songBefore;
                    song.SavedFile    = "Radios\\" + songBefore + ".mp3";
                    song.StartTime    = 0;
                    song.EndTime      = 0;
                    song.NumberPlayed = 1;
                    song.ExportSong   = false;
                    song.YoutubeLink  = YoutubeLink;
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        Songs.Add(song);
                        var convertedJson = JsonConvert.SerializeObject(Songs, Formatting.Indented);
                        File.WriteAllText("Radios\\" + RadioName + ".json", convertedJson);
                    }));
                }
                else
                {
                    songsearched.NumberPlayed++;
                }
            }
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            // Keyword
            string querystring = "test";

            // Number of result pages
            int querypages = 1;

            ////////////////////////////////
            // Starting searchquery
            ////////////////////////////////

            var items = new VideoSearch();

            int i = 1;

            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                Console.WriteLine(i + "###########################");
                Console.WriteLine("Title: " + item.Title);
                Console.WriteLine("Author: " + item.Author);
                Console.WriteLine("Duration: " + item.Duration);
                Console.WriteLine("Url: " + item.Url);
                Console.WriteLine("Thumbnail: " + item.Thumbnail);
                Console.WriteLine("");

                i++;
            }

            Console.ReadLine();
        }
Esempio n. 10
0
        private string SearchVideo(string search)
        {
            VideoSearch      items      = new VideoSearch();
            List <Video>     list       = new List <Video>();
            VideoInformation firstVideo = items.SearchQuery(search, 1).FirstOrDefault();

            return(firstVideo.Url);
        }
Esempio n. 11
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     lista.Clear();
     listBox.Items.Clear();
     YoutubeSearch.VideoSearch ze = new VideoSearch();
     ze.SearchQuery(textBox.Text, 1);
     foreach (var video in ze.SearchQuery(textBox.Text, 1))
     {
         VideoMeu temp = new VideoMeu();
         temp.Autor  = WebUtility.HtmlDecode(video.Author);
         temp.Titulo = WebUtility.HtmlDecode(video.Title);
         temp.Imagem = video.Thumbnail;
         temp.Url    = video.Url;
         lista.Add(temp);
         listBox.Items.Add(WebUtility.HtmlDecode(video.Title));
     }
     listBox.SelectedIndex = 0;
 }
Esempio n. 12
0
        public async Task PlayLocal(params string[] search)
        {
            int querypages = 1;

            var items   = new VideoSearch();
            var message = await Context.Channel.SendMessageAsync("Searching...");

            var urls      = items.SearchQuery(string.Join(" ", search), querypages);
            var duration  = urls.First().Duration;
            var thumbnail = urls.First().Thumbnail;

            await message.ModifyAsync(msg => msg.Content = "Downloading " + urls.First().Title + "...");

            var urlToDownload   = urls.First().Url;
            var newFilename     = Guid.NewGuid().ToString();
            var mp3OutputFolder = Environment.CurrentDirectory + "/songs/";
            var downloader      = new YoutubeDL();

            downloader.VideoUrl      = urlToDownload;
            downloader.YoutubeDlPath = @"C:\Users\thoma\source\repos\CoolDiscordBot\CoolDiscordBot\bin\Debug\youtube-dl.exe";
            downloader.Options.FilesystemOptions.Output = Environment.CurrentDirectory + "/songs/" + newFilename;
            downloader.PrepareDownload();
            downloader.Download();
            var info = downloader.GetDownloadInfo();

            while (downloader.ProcessRunning == true)
            {
                await Task.Delay(50);
            }

            EmbedBuilder builder = new EmbedBuilder();

            builder.Title = Context.User.Username + "#" + Context.User.Discriminator;
            builder.AddField("Name", info.Title);
            builder.ThumbnailUrl = thumbnail;
            builder.AddField("Duration", duration);
            builder.AddField("Url", urlToDownload);


            await ReplyAsync("t", false, builder.Build());

            audioModule = new audiomodule();
            var voiceChannel = ((IVoiceState)Context.User).VoiceChannel;

            if (voiceChannel is null)
            {
                await ReplyAsync($"{Context.User.Mention} you are not in a voice channel!");

                return;
            }
            var audioClient = await voiceChannel.ConnectAsync().ConfigureAwait(false);

            Console.WriteLine(newFilename);
            string path = "\"" + Environment.CurrentDirectory + "/songs/" + newFilename + ".mkv" + "\"";

            await audioModule.PlayLocalMusic(path, audioClient);
        }
Esempio n. 13
0
        public async Task Yearch([Remainder] string message)
        {
            var    items = new VideoSearch();
            string fvid  = "Something went wrong";

            foreach (var item in items.SearchQuery(message, 1))
            {
                fvid = Convert.ToString(item.Url);
                break;
            }
            await Context.Channel.SendMessageAsync(fvid);
        }
Esempio n. 14
0
  protected void Button1_Click1(object sender, EventArgs e)
  {
      string search = searchtextbox.Text.ToString();

      // Number of result pages
      int querypages = 1;

      ////////////////////////////////
      // Starting searchquery
      ////////////////////////////////

      var items = new VideoSearch();

      int i       = 1;
      var videoId = string.Empty;

      foreach (var item in items.SearchQuery(search, querypages))
      {
          //Console.WriteLine(i + "###########################");
          //Console.WriteLine("Title: " + item.Title);
          //Console.WriteLine("Author: " + item.Author);
          //Console.WriteLine("Description: " + item.Description);
          //Console.WriteLine("Duration: " + item.Duration);
          //Console.WriteLine("Url: " + item.Url);
          //Console.WriteLine("Thumbnail: " + item.Thumbnail);
          //Console.WriteLine("");

          var url = item.Url;
          var uri = new Uri(url);

          // you can check host here => uri.Host <= "www.youtube.com"

          var query = HttpUtility.ParseQueryString(uri.Query);

          // var videoId = string.Empty;

          if (query.AllKeys.Contains("v"))
          {
              videoId = query["v"];
          }
          else
          {
              videoId = uri.Segments.Last();
          }
          HtmlGenericControl div = new HtmlGenericControl("div");
          div.Attributes.Add("id", i.ToString());
          testinner.Controls.Add(div);
          div.InnerHtml = "<div class='col - sm - 4'><iframe width='560' height='315' src='https://www.youtube.com/embed/" + videoId + "' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe><a href = Youtubevideosupload.aspx?youtubeid=" + videoId + "&teacher=" + userkey + "&duration=" + item.Duration + "> Share with your students</a> </div>";


          i++;
      }
  }
Esempio n. 15
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Keywords to make sure we keep in scope and not have a trump russia video show up
            // there is probably better ways to do this but this is easy and works incredibility well
            string keywords = "Modded Minecraft 1.12 Tutorial English ";

            //processed query string
            string querystring = keywords + textBox1.Text;

            // Number of result pages
            int querypages = 1;

            // Offset value for querypages
            int querypagesOffset = 1;

            //using Youtubesearch library
            var items = new VideoSearch();

            int i = 0;

            // Was an experiment to catch people wanting to figure out how to chunkload
            // example of sometype of keyword trigger (not needed)
            if (querystring.Contains("chunk load") || querystring.Contains("chunkload"))
            {
                textBox2.Text = "Run '/kit scl' for chunk loaders. You have access to two chunkloaders. Use F3+g to show chunk borders.";
                return;
            }

            //loop through to pull the 3 top videos
            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                //when the search results return a low confidence, youtube replies with the 3 same low confidence video results.
                //for some reason these low confidence results likes to tell us how to make a server and this is due to the predefined key words taking prioity.
                //if keywords change, the default results will change

                if (item.Title.Contains("How to Make a Modded Minecraft Server"))
                {
                    textBox2.Text = "Invalid results! Make sure to use mod name or item name, needs to be descriptive!";
                    break;
                }

                i++;
                textBox2.AppendText("Title: " + item.Title + Environment.NewLine +
                                    "URL: " + item.Url + Environment.NewLine);


                if (i == 3)
                {
                    break;
                }
            }
        }
Esempio n. 16
0
        private void searchButton_Click(object sender, RoutedEventArgs e)
        {
            VideoSearch vs = new VideoSearch();

            string query = searchTextBox.Text;

            // Make the query
            List <VideoInformation> vlist = vs.SearchQuery(query, 1);

            // Bind vlist to the listbox.
            SkinListBox.ItemsSource = vlist;
            VideoInformation v = new VideoInformation();
        }
        private List <VideoInformation> Search(string query, int maxResults, Func <VideoInformation, int> comparer = null)
        {
            var items = new VideoSearch();

            // ordering by similarity to title by default, I should look into how that algorithm works sometime, seems interesting
            var results = items.SearchQuery(query, 1).OrderBy(comparer ?? (x => LevenshteinDistance.Compute(x.Title, query))).ToList();

            if (results.Count > maxResults)
            {
                results.RemoveRange(maxResults, results.Count - maxResults);
            }
            return(results);
        }
Esempio n. 18
0
        //example for synchronous execution
        private static void SyncQuery()
        {
            var querystring = "test";
            int querypages  = 1;

            var items = new VideoSearch();

            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                Console.WriteLine("##########################");
                Console.WriteLine(item.Title);
                Console.WriteLine("");
            }
        }
Esempio n. 19
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();

            var items = new VideoSearch();

            int i = 1;

            querypages = int.Parse(comboBox2.SelectedItem.ToString());

            foreach (var item in items.SearchQuery(textBox2.Text, querypages))
            {
                dataGridView1.Rows.Add(item.Title, item.Author, item.Description, item.Duration, item.Url, GetImageFromUrl(item.Thumbnail));
            }
        }
Esempio n. 20
0
        public string YTSearch(string search)
        {
            var results = new VideoSearch();

            ResultsList = results.SearchQuery(search, 1);
            string searchresults = "```1. " + ResultsList[0].Title + " " + ResultsList[0].Duration;

            for (int i = 1; i < 5; i++)
            {
                searchresults = searchresults + Environment.NewLine + (i + 1).ToString() + ". " + ResultsList[i].Title + " " + ResultsList[i].Duration;
            }

            searchresults = searchresults + "```";
            return(searchresults);
        }
Esempio n. 21
0
        public async Task PlayCmd([Remainder] string song)
        {
            //Join the audio if not in it already
            if (!_service.joined)
            {
                await _service.JoinAudio(Context.Guild, (Context.User as IVoiceState).VoiceChannel);
            }

            //If the song is a youtube link and not part of a playlist
            if (song.Contains("www.youtube.com/watch?v=") && !song.Contains("&list="))
            {
                await _service.SendLinkAsync(Context.Guild, Context.Channel, song, Context.Message.Author);
            }
            else if (song.Contains("&list="))
            {
                //Just get the song url not with the list
                int listIndex  = song.IndexOf("&list=");
                int indexIndex = song.IndexOf("&index=");

                string JustSong = (listIndex < indexIndex) ? song.Substring(0, listIndex) : song.Substring(0, indexIndex);

                await _service.SendLinkAsync(Context.Guild, Context.Channel, JustSong, Context.Message.Author);
            }
            else
            {
                //Otherwise do a search for the string
                var    items = new VideoSearch();
                int    i     = 1;
                string list  = "";
                foreach (var item in items.SearchQuery(song, 1))
                {
                    //List the first five results from the youtube search
                    list += $"{i}: {item.Title} ({item.Duration})\n";

                    choices[i - 1] = item;

                    if (i == 5)
                    {
                        break;
                    }

                    i++;
                }
                choiceMessage = await Context.Channel.SendMessageAsync(list);
            }
        }
Esempio n. 22
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            VideoSearch        items = new VideoSearch();
            List <SearchVideo> _list = new List <SearchVideo>();

            foreach (var item in items.SearchQuery(tbSearch.Text, 1))
            {
                SearchVideo _video     = new SearchVideo();
                byte[]      imageDatas = new WebClient().DownloadData(item.Thumbnail);
                using (MemoryStream ms = new MemoryStream(imageDatas))
                {
                    _video.Thumbnail = Image.FromStream(ms);
                }
                _list.Add(_video);
            }
            searchMinSBindingSource.DataSource = _list;
        }
Esempio n. 23
0
File: hit.cs Progetto: piopy/hit
        private void s_button_Click(object sender, EventArgs e)
        {
            if (tosearch.Text == "")
            {
                return;
            }

            risultati.Items.Clear();
            YoutubeSearch.VideoSearch search = new VideoSearch();
            List <VideoInformation>   results;

            results = search.SearchQuery(tosearch.Text, 3);
            foreach (VideoInformation infos in results)
            {
                risultati.Items.Add(new YoutubeVideo(infos));
            }
        }
Esempio n. 24
0
        static void Main(string[] args)
        {
            // Keyword
            string querystring = "test";

            // Number of result pages
            int querypages = 1;

            ////////////////////////////////
            // Starting searchquery
            ////////////////////////////////

            var items = new VideoSearch();

            //specify the encoding for this object
            items.encoding = Encoding.UTF8;


            int i = 1;

            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                Console.WriteLine(i + ". ###########################");
                Console.WriteLine("Title: " + item.Title);
                Console.WriteLine("Author: " + item.Author);
                Console.WriteLine("Description: " + item.Description);
                Console.WriteLine("Duration: " + item.Duration);
                Console.WriteLine("Url: " + item.Url);
                Console.WriteLine("Thumbnail: " + item.Thumbnail);
                Console.WriteLine("ViewCount: " + item.ViewCount);
                Console.WriteLine("Livestream: " + (item.IsLivestream ? "Yes" : "No"));
                Console.WriteLine("");

                i++;
            }

            //----------------------------------------
            //see difference of sync and async
            SyncQuery();
            AsyncQuery();
            OffsetQuery();


            Console.ReadLine();
        }
Esempio n. 25
0
        public List <YoutubeItem> GetResults(string inKeyword)
        {
            List <YoutubeItem> list  = new List <YoutubeItem>();
            VideoSearch        items = new VideoSearch();

            foreach (var item in items.SearchQuery(inKeyword, 1))
            {
                if (item.Title.Length >= 80)
                {
                    item.Title = item.Title.Substring(0, 80);
                }

                list.Add(new YoutubeItem {
                    Title = item.Title, Url = item.Url
                });
            }
            return(list);
        }
Esempio n. 26
0
        public async Task YoutubeAsync([Remainder] string querystring)
        {
            // Number of result pages
            int querypages = 1;

            ////////////////////////////////
            // Starting searchquery
            ////////////////////////////////

            var items = new VideoSearch();


            foreach (var item in items.SearchQuery(querystring, querypages))
            {
                await ReplyAsync(item.Url);

                break;
            }
        }
        public IActionResult Search(VideoSearchViewModel videoSearchViewModel)
        {
            VideoSearch  items = new VideoSearch();
            List <Video> list  = new List <Video>();

            foreach (var item in items.SearchQuery(videoSearchViewModel.SearchText, 1))
            {
                Video video = new Video();
                video.Title     = item.Title;
                video.Author    = item.Author;
                video.Url       = item.Url;
                video.Thumbnail = item.Thumbnail;
                list.Add(video);
            }
            videoSearchViewModel.List = list;


            return(View(videoSearchViewModel));
        }
Esempio n. 28
0
        public string Search(string query, IMessageChannel channel)
        {
            int    queryPages   = 1;
            int    queryResults = 1;
            var    items        = new VideoSearch();
            int    x            = 0;
            string url          = null;

            foreach (var item in items.SearchQuery(query, queryPages))
            {
                channel.SendMessageAsync(item.Url.ToString());
                x++;
                url = item.Url.ToString();
                if (x == queryResults)
                {
                    break;
                }
            }
            return(url);
        }
Esempio n. 29
0
        private void SearchYoutube()
        {
            VideoSearch  items = new VideoSearch();
            List <Video> list  = new List <Video>();

            foreach (var item in items.SearchQuery(txtSearch.Text, 1))
            {
                Video video = new Video();
                video.Title = item.Title;
                video.Url   = item.Url;

                byte[] imageBytes = new WebClient().DownloadData(item.Thumbnail);
                using (MemoryStream ms = new MemoryStream(imageBytes))
                {
                    video.Thumbnail = Image.FromStream(ms);
                }
                list.Add(video);
            }
            videoBindingSource.DataSource = list;
        }
Esempio n. 30
0
 private void SearchYoutube(string searchtxt)
 {
     try
     {
         ShowPopular  = false;
         this.Enabled = false;
         musiclist.Items.Clear();
         var items = new VideoSearch();
         foreach (var item in items.SearchQuery(searchtxt, 2))
         {
             musiclist.Items.Add(item.Url, item.Title.Replace("&quot;", "").Replace("&amp;", "").Replace("&#39;", ""), 0);
         }
         this.Enabled = true;
     }
     catch
     {
         MessageBox.Show("오류 발생 프로그램을 종료합니다.");
         Process.GetCurrentProcess().Kill();
     }
 }