Exemplo n.º 1
0
        /// <summary>
        ///  helper method to add extensions to the evententry
        /// </summary>
        private void addYouTubeEntryExtensions() {
            MediaGroup mg = new MediaGroup();
            this.AddExtension(mg);

            GeoRssExtensions.AddExtension(this);
            AppControl app = new AppControl();
            app.ProtocolMajor = this.ProtocolMajor;
            app.ProtocolMinor = this.ProtocolMinor;

            AppControl acf = FindExtensionFactory(app.XmlName, app.XmlNameSpace) as AppControl;
            if (acf == null) {
                // create a default appControl element
                acf = new AppControl();
                this.AddExtension(acf);
            }

            // add the youtube state element
            acf.ExtensionFactories.Add(new State());

            // things from the gd namespce
            this.AddExtension(new Comments());
            this.AddExtension(new Rating());

            // add youtube namespace elements
            this.AddExtension(new Episode());
            this.AddExtension(new Statistics());
            this.AddExtension(new Location());
            this.AddExtension(new Recorded());
            this.AddExtension(new Uploaded());
            this.AddExtension(new YtRating());
            this.AddExtension(new YtAccessControl());
        }
Exemplo n.º 2
0
        /// <summary>
        ///  helper method to add extensions to the evententry
        /// </summary>
        private void addYouTubeEntryExtensions()
        {
            MediaGroup mg = new MediaGroup();

            this.AddExtension(mg);

            GeoRssExtensions.AddExtension(this);
            AppControl app = new AppControl();

            app.ProtocolMajor = this.ProtocolMajor;
            app.ProtocolMinor = this.ProtocolMinor;


            AppControl acf = FindExtensionFactory(app.XmlName, app.XmlNameSpace) as AppControl;

            if (acf == null)
            {
                // create a default appControl element
                acf = new AppControl();
                this.AddExtension(acf);
            }
            // add the youtube state element
            acf.ExtensionFactories.Add(new State());

            // things from the gd namespce
            this.AddExtension(new Comments());
            this.AddExtension(new Rating());

            // add youtube namespace elements
            this.AddExtension(new Statistics());
            this.AddExtension(new Location());
            this.AddExtension(new Recorded());
            this.AddExtension(new Uploaded());
        }
Exemplo n.º 3
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 + "------------------------------------------";
            //}
        }