コード例 #1
0
        public void TestVideoProps()
        {
            var ret = yt.SearchQuery("\"v5qqta9WoBU\"");
            var vid = ret[0];

            Assert.AreEqual("Killerpils", vid.Author);
            Assert.AreEqual("DCS: Inverted Refueling The F18 At Sea Level", vid.Title);
            Assert.AreEqual("This is my response to the Grim Reapers inverted refueling challenge, refueling the F18 only a few feet above sea level.", vid.Description); // cmp up to first newline
            Assert.AreEqual("4:04", vid.Duration);

            Assert.AreEqual(false, vid.IsLivestream);
            Assert.AreEqual(false, vid.IsLivestreamUncertain);
            Assert.AreEqual(false, vid.NoAuthor);
            Assert.AreEqual(false, vid.NoDescription);
            Assert.AreEqual("https://www.youtube.com/watch?v=v5qqta9WoBU", vid.Url);


            // view count and thumbnail cannot be determined
            // both are not necessarily constant
        }
コード例 #2
0
        public void cargarresults()
        {
            try
            {
                RunOnUiThread(() =>
                {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    alerta = new ProgressDialog(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                    alerta.SetTitle("Buscando videos sugeridos");
                    alerta.SetMessage("Por favor espere...");
                    alerta.SetCancelable(false);
                    alerta.Create();
                    alerta.Show();
                });

                YoutubeSearch.VideoSearch             buscar  = new YoutubeSearch.VideoSearch();
                List <YoutubeSearch.VideoInformation> results = new List <YoutubeSearch.VideoInformation>();
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (YoutubePlayerServerActivity.gettearinstancia().sugerencias.Count > 0)
                    {
                        results = YoutubePlayerServerActivity.gettearinstancia().sugerencias;
                    }
                    else
                    {
                        results = buscar.SearchQuery("", 1);
                        YoutubePlayerServerActivity.gettearinstancia().sugerencias = results;
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().sugerencias.Count > 0)
                    {
                        results = Mainmenu.gettearinstancia().sugerencias;
                    }
                    else
                    {
                        results = buscar.SearchQuery("", 1);
                        Mainmenu.gettearinstancia().sugerencias = results;
                    }
                }



                List <PlaylistElement> listafake = new List <PlaylistElement>();
                foreach (var data in results)
                {
                    listafake.Add(new PlaylistElement
                    {
                        Name = WebUtility.HtmlDecode(data.Title),
                        Link = data.Url
                    });
                }
                RunOnUiThread(() =>
                {
                    adaptadorcartas adap = new adaptadorcartas(listafake, this);
                    adap.ItemClick      += (aa, aaa) =>
                    {
                        RunOnUiThread(() =>
                        {
                            var elemento   = listafake[aaa.Position];
                            Intent intento = new Intent(this, typeof(customdialogact));

                            intento.PutExtra("url", elemento.Link);
                            intento.PutExtra("titulo", elemento.Name);
                            intento.PutExtra("imagen", "http://i.ytimg.com/vi/" + elemento.Link.Split('=')[1] + "/mqdefault.jpg");
                            StartActivity(intento);
                        });
                    };
                    listasugerencias.SetAdapter(adap);
                    alerta.Dismiss();

                    if (listafake.Count > 0)
                    {
                        secciones[3].Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        secciones[3].Visibility = ViewStates.Gone;
                    }
                });
            }
            catch (Exception)
            {
                RunOnUiThread(() => alerta.Dismiss());
            }
        }
コード例 #3
0
ファイル: QueryTest.cs プロジェクト: Mayerch1/YoutubeSearch
        public void TestSinglePage()
        {
            var ret = yt.SearchQuery("test");

            Assert.AreEqual(ret, ret); // prevent optimisation
        }