• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# YouTubeRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中YouTubeRequest的典型用法代码示例。如果您正苦于以下问题:C# YouTubeRequest类的具体用法?C# YouTubeRequest怎么用?C# YouTubeRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



YouTubeRequest类属于命名空间,在下文中一共展示了YouTubeRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Details

        //
        // GET: /Candidates/Details/5
        public ViewResult Details(int id)
        {
            Candidate candidate = context.Candidates.Single(x => x.Id == id);

            YouTubeRequest req = new YouTubeRequest(new YouTubeRequestSettings("OpenPac", "AI39si5R4licFRGAWgvNI5G6ANPqGfcuyuTWW55nb7rE49bv5kIyMm7YbGpfvUpCX_5nNBJYXztGiUvhULoBQOoEUVQD8xI-Nw"));

            Uri u = new Uri(string.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", candidate.YouTubeId));

            Feed<Video> videos = req.Get<Video>(u);

            List<YouTubeVideo> videoUrls = new List<YouTubeVideo>();

            foreach (Video v in videos.Entries)
            {
                videoUrls.Add(new YouTubeVideo
                {
                    VideoId = v.YouTubeEntry.VideoId,
                    Description = v.Description,
                    Title = v.Title,
                    Rating = v.YouTubeEntry.Rating == null ? 0.0 : v.YouTubeEntry.Rating.Average,
                    Updated = v.YouTubeEntry.Updated,
                    Duration = v.YouTubeEntry.Duration.IntegerValue,
                    YouTubeUrl = v.WatchPage.ToString()
                });
            }

            ViewBag.YouTubeVideos = videoUrls;

            return View(candidate);
        }
开发者ID:felluss,项目名称:open-pac,代码行数:32,代码来源:CandidatesController.cs


示例2: Youtube

 public Youtube()
 {
     YouTubeRequestSettings settings = new YouTubeRequestSettings("DemoFacebookFeature", "AI39si4cTAJSx5HF1qHrhfD_ws7kUEnk0Tr02WcFPiMf96nTxczLMT8a_lJqGhlbKRsY0YZE5BYhO-gu2y7rXsQesC3Jf2-jGA");
     Request = new YouTubeRequest(settings);
     VideoFeeds = new List<Video>();
     NewVideos = new List<Video>();
 }
开发者ID:elephunt,项目名称:Facebook-Desktop-App-With-Features,代码行数:7,代码来源:Youtube.cs


示例3: MainForm

        //string wth; FIXED -- Issue with object scope? Will fix later. This is a workaround.
        public MainForm()
        {
            InitializeComponent();
            buttonUpload.Enabled = false; //Disable buttons by default.
            textComplete.Visible = false;
            btnDelete.Enabled = false;
            btnAdd.Enabled = false;

            comboCategory.SelectedIndex = 7; //No selection is invalid.
            vidFlag = false;            //User must provide credentials and a video before uploading.
            loginFlag = false;

            //Saved settings
            folderBrowserDialog.SelectedPath = stored_IncludeFolder;
            includeTextBox.Text = stored_IncludeFolder;
            VideoWatcher.Path = stored_IncludeFolder;

            VideoFilename = Youtube_Uploader.Properties.Settings.Default.FilesLib;
            VideoId = Youtube_Uploader.Properties.Settings.Default.IdLib;
            VideoStatus = Youtube_Uploader.Properties.Settings.Default.StatusLib;

            YouTubeRequestSettings settings = new YouTubeRequestSettings("Deprecated", key, Youtube_Uploader.Properties.Settings.Default.UsernameYT, Youtube_Uploader.Properties.Settings.Default.PasswordYT);
            request = new YouTubeRequest(settings);

            drawVideoList();
        }
开发者ID:BECKLESPINAX,项目名称:YouTube-Uploader,代码行数:27,代码来源:MainForm.cs


示例4: BBuscador

        protected void BBuscador(String track)
        {
            string spotUrl = String.Format("http://ws.spotify.com/search/1/track?q={0}", track);
            WebClient spotService = new WebClient();
            spotService.Encoding = Encoding.UTF8;
            spotService.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SpotService_DownloadTracksCompleted);
            spotService.DownloadStringAsync(new Uri(spotUrl));

            YouTubeRequest request = new YouTubeRequest(settings);
            YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);
            query.OrderBy = "relevance";
            query.Query = track;
            query.SafeSearch = YouTubeQuery.SafeSearchValues.None;
            Feed<Video> videoFeed = request.Get<Video>(query);
            if (videoFeed.Entries.Count() > 0)
            {
                video1 = videoFeed.Entries.ElementAt(0);
                literal1.Text = String.Format(embed, video1.VideoId);
                if (videoFeed.Entries.Count() > 1)
                {
                    video1 = videoFeed.Entries.ElementAt(1);
                    literal1.Text += String.Format(embed, video1.VideoId);
                }
            }
        }
开发者ID:mmarinero,项目名称:little-class-projects,代码行数:25,代码来源:Default.aspx.cs


示例5: Search

        public IEnumerable<VideoModel> Search(string searchText)
        {
            var modelList = new List<VideoModel>();
            var settings = new YouTubeRequestSettings("YouTunes", "AIzaSyCgNs6G_0w36g6dhAxxBL4nL7wD3C6jmOw");
            var request = new YouTubeRequest(settings);
            var query = new YouTubeQuery("https://gdata.youtube.com/feeds/api/videos") { Query = searchText };

            Feed<Video> feed = null;

            try
            {
                feed = request.Get<Video>(query);

                foreach (var video in feed.Entries)
                {
                    modelList.Add(new VideoModel() { VideoTitle = video.Title, VideoId = video.VideoId });
                }
            }
            catch (GDataRequestException gdre)
            {

            }

            return modelList;
        }
开发者ID:kkoop83,项目名称:YouTunes,代码行数:25,代码来源:YoutubeService.cs


示例6: GDataResultAggregator

    public GDataResultAggregator(string playlistURL)
    {
      YouTubeRequestSettings settings = new YouTubeRequestSettings(APPNAME, CLIENTID, DEVELKEY);
      YouTubeRequest request = new YouTubeRequest(settings);

      _videoFeed = request.Get<Video>(new Uri(playlistURL));
    }
开发者ID:mumairali,项目名称:youtube-playlist-downloader,代码行数:7,代码来源:GDataResultAggregator.cs


示例7: GetRequest1

        public static YouTubeRequest GetRequest1()
        {
            YouTubeRequestSettings settings = new YouTubeRequestSettings("LifeTube",
                                  ConfigurationManager.AppSettings["YouTubeAPIKey"],
                                  ConfigurationManager.AppSettings["YouTubeUsername"],
                                  ConfigurationManager.AppSettings["YouTubePassword"]);

            YouTubeRequest request = new YouTubeRequest(settings);
            Google.YouTube.Video newVideo = new Google.YouTube.Video();

            newVideo.Title = "My first Movie";
            newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
            newVideo.Keywords = "cars, funny";
            newVideo.Description = "My description";
            newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));
            newVideo.YouTubeEntry.Private = false;

            newVideo.YouTubeEntry.setYouTubeExtension("location", "Somerville, MA");
            var token = request.CreateFormUploadToken(newVideo);
            var strToken = token.Token;
            var strFormAction = token.Url + "?nexturl=http://[ LifeTube ]/form/post-video-step2.aspx?Complete=1";

            //Session["YTRequest"] = request;

            return request;
            //return View(request);
        }
开发者ID:sarmin,项目名称:LifeTube.me,代码行数:27,代码来源:VideoController.cs


示例8: RealSearch

        private static IObservable<IReadOnlyList<ISong>> RealSearch(string searchTerm)
        {
            var query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri)
            { 
                OrderBy = "relevance",
                Query = searchTerm,
                SafeSearch = YouTubeQuery.SafeSearchValues.None,
                NumberToRetrieve = RequestLimit
            };

            var settings = new YouTubeRequestSettings("Espera", ApiKey);
            var request = new YouTubeRequest(settings);

            return Observable.FromAsync(async () =>
            {
                Feed<Video> feed = await Task.Run(() => request.Get<Video>(query));
                List<Video> entries = await Task.Run(() => feed.Entries.ToList());

                return (from video in entries
                    let url = video.WatchPage.OriginalString.Replace("&feature=youtube_gdata_player", String.Empty).Replace("https://", "http://")
                    select new YoutubeSong()
                    {
                        Artist = video.Uploader, Title = video.Title, OriginalPath = url
                    }).ToList();
            })
            .Catch<IReadOnlyList<YoutubeSong>, Exception>(ex => Observable.Throw<IReadOnlyList<YoutubeSong>>(new Exception("YoutubeSongFinder search failed", ex)));
        }
开发者ID:dbeattie71,项目名称:flashbang,代码行数:27,代码来源:YouTubeFinder.cs


示例9: CreateYoutubeVideo

        public static YouTubeVideo.Video CreateYoutubeVideo(string title, string keywords, string description, bool isPrivate, byte[] content, string fileName, string contentType)
        {
            //YouTubeRequestSettings settings = new YouTubeRequestSettings("Logicum", "YouTubeDeveloperKey", "YoutubeUserName", "YoutubePassword");
              //      YouTubeRequestSettings settings = new YouTubeRequestSettings("Zerofootprint", "AI39si5uAJcnGQWqT7bOooT00fTbkCsMjImXlYoyZpkArc49nQvQF-UhxIQDUpwoLxdvf85t97K3wUP2SDrdm1Q8IchJT5mYgQ", "[email protected]", "[email protected]");
            YouTubeRequestSettings settings =
              new YouTubeRequestSettings("Zerofootprint", "532982290458-ua1mk31m7ke3pee5vas9rcr6rgfcmavf.apps.googleusercontent.com", "AI39si5uAJcnGQWqT7bOooT00fTbkCsMjImXlYoyZpkArc49nQvQF-UhxIQDUpwoLxdvf85t97K3wUP2SDrdm1Q8IchJT5mYgQ");
            YouTubeRequest request = new YouTubeRequest(settings);

            YouTubeVideo.Video newVideo = new YouTubeVideo.Video();

            newVideo.Title = title;
            newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
            newVideo.Keywords = keywords;
            newVideo.Description = description;
            newVideo.YouTubeEntry.Private = isPrivate;
            //newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag”, YouTubeNameTable.DeveloperTagSchema));

            // alternatively, you could just specify a descriptive string newVideo.YouTubeEntry.setYouTubeExtension(“location”, “Mountain View, CA”);
            //newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);

            Stream stream = new MemoryStream(content);
            newVideo.YouTubeEntry.MediaSource = new MediaFileSource(stream, fileName, contentType);
            YouTubeVideo.Video createdVideo = request.Upload(newVideo);

            return createdVideo;
        }
开发者ID:gitAakash,项目名称:OMS,代码行数:26,代码来源:VideoController.cs


示例10: GetRequest

 public static YouTubeRequest GetRequest()
 {
     YouTubeRequestSettings settings = new YouTubeRequestSettings("Chalkable Youtube app",
                                         "AI39si6y_3ZKWG2A4_-v5ogSal_5Y41jmsiQ3aYD0AUVHBTT7mNjOAhh1r24xJWUkki67hLg0l4EXZHS-d4h-kysPd9yGAV0Wg");
     settings.AutoPaging = true;
     YouTubeRequest request = new YouTubeRequest(settings);
     return request;
 }
开发者ID:Chalkable,项目名称:YouTube_Ed_App,代码行数:8,代码来源:YoutubeConnector.cs


示例11: YouTubePlugin

 public YouTubePlugin() {
     random = new Random();
     ytr = new YouTubeRequest(
             new YouTubeRequestSettings("Dynamic Skype Bot",
                                        "ytapi-SebastianPaaske-DynamicSkypeBot-b3hp906d-0",
                                        "AI39si59QPSboGTxgVnE0OD5nO49p1ok9KAoM0BuT9KkyL-VNzkrUA2F1O46FqArUrppYc5AGwrE-xQhaefb_cp4mgHuw36F9Q")
             );
     randomCache = new Queue<string>();
 }
开发者ID:shruggles,项目名称:dynamicskypebot,代码行数:9,代码来源:YouTubePlugin.cs


示例12: GetById

        public VideoEntry GetById(string videoId)
        {
            var request = new YouTubeRequest(_settings);

            var video =
                request.Retrieve<Video>(new Uri(String.Format("http://gdata.youtube.com/feeds/api/videos/{0}", videoId)));

            return _videoEntryFactory.Build(video);
        }
开发者ID:TryingToImprove,项目名称:myv,代码行数:9,代码来源:YouTubeRepository.cs


示例13: GetRequest

 private static YouTubeRequest GetRequest()
 {
     var youtubeApiKey = ConfigurationManager.AppSettings["youtubeApiKey"];
     var applicationName = ConfigurationManager.AppSettings["applicationName"];
     var youtubeUserName = ConfigurationManager.AppSettings["youtubeUserName"];
     var youtubePassword = ConfigurationManager.AppSettings["youtubePassword"];
     var settings = new YouTubeRequestSettings(applicationName, youtubeApiKey, youtubeUserName, youtubePassword);
     var request = new YouTubeRequest(settings);
     return request;
 }
开发者ID:MassImpact,项目名称:PollinatorMap-Full,代码行数:10,代码来源:YouTubeUltility.cs


示例14: InitYouTubeRequest

        public bool InitYouTubeRequest ()
        {
            YouTubeRequestSettings yt_request_settings = new YouTubeRequestSettings (app_name, client_id, developer_key);
            this.yt_request = new YouTubeRequest (yt_request_settings);

            if (this.yt_request != null && yt_request_settings != null) {
                return true;
            }

            return false;
        }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:11,代码来源:YouTubeData.cs


示例15: AddVideo

        private void AddVideo(YouTubeRequest request, string urlTemplate, string maxResultsKey, VideoList videoList)
        {
            int maxResults = ConfigService.GetConfig(maxResultsKey, 0);
            if (maxResults > 0)
            {
                string url = string.Format(urlTemplate, maxResults);
                Feed<Video> videos = request.Get<Video>(new Uri(url));

                YouTubeVideoParser parser = new YouTubeVideoParser();
                parser.Parse(videos, videoList);
            }
        }
开发者ID:jcurlier,项目名称:theinternetbuzz,代码行数:12,代码来源:YouTubeTrendsService.cs


示例16: Guncelle

        private void Guncelle()
        {
            using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=hesap.mdb"))
            {
                conn.Open();
                OleDbCommand komut = new OleDbCommand();
                komut.Connection = conn;
                komut.CommandText = "Select * from hesap"; // sorgu / komut cumlemi yazıyorum.
                komut.ExecuteNonQuery(); // insert , updateiçin gerekli satir sayisi donduruyoruz.
                OleDbDataReader dr = komut.ExecuteReader(); // datareader olusturup komut sorgulayıp veritabaninda okuma işlemini tanıtıyoruz
                while (dr.Read()) // datareader ile okuyoruz.
                {
                    string hadi = dr["hadi"].ToString();
                    string kadi = dr["kadi"].ToString();
                    string q;
                    using (WebClient asd = new WebClient())
                    {
                        asd.Encoding = Encoding.UTF8;
                        q = asd.DownloadString("http://gdata.youtube.com/feeds/api/users/" + kadi + "/uploads?v=2&alt=jsonc&max-results=0");
                    }
                    string[] adet1 = q.Split(new string[] { "totalItems\":" }, StringSplitOptions.None);
                    string[] adet2 = adet1[1].Split(',');
                    listView1.Items.Add(new ListViewItem(new string[] { hadi, "Adet: "+adet2[0] }));
                }
                dr.Close();
                komut.ExecuteNonQuery(); // insert , updateiçin gerekli satir sayisi donduruyoruz.
                dr = komut.ExecuteReader(); // datareader olusturup komut sorgulayıp veritabaninda okuma işlemini tanıtıyoruz
                while (dr.Read()) // datareader ile okuyoruz.
                {
                    string kadi = dr["hadi"].ToString(); // veritabanimdaki "kadi" alanımdaki veriyi alip kadi değişkenine atıyorum(yukarıda string olusturmustum)
                    string sifre = dr["hsifresi"].ToString(); // aynı durum söz konusu
                    string devkey = dr["devkey"].ToString();
                    Random a = new Random();
                    string id = a.Next(100000, 999999).ToString();
                    YouTubeRequestSettings settings = new YouTubeRequestSettings(id, devkey, kadi,sifre);
                    YouTubeRequest request = new YouTubeRequest(settings);

                    string feedUrl = "https://gdata.youtube.com/feeds/api/users/default/uploads";

                    Feed<Video> videoFeed = request.Get<Video>(new Uri(feedUrl));
                    foreach (Video entry in videoFeed.Entries)
                    {
                        string vid_thumb ="http://img.youtube.com/vi/"+entry.VideoId+"/0.jpg";
                        int izlenme = entry.ViewCount;
                        if(izlenme == -1)
                            izlenme = 0;
                        listView1.Items.Add(new ListViewItem(new string[] { kadi,entry.YouTubeEntry.Title.Text,izlenme.ToString()  }));
                    }
                }
            }
        }
开发者ID:voyl,项目名称:myprojects,代码行数:51,代码来源:Form1.cs


示例17: GetTitle

        public VideoTitleParseResult GetTitle(string id)
        {
            var settings = new YouTubeRequestSettings("VocaDB", null);
            var request = new YouTubeRequest(settings);
            var videoEntryUrl = new Uri(string.Format("http://gdata.youtube.com/feeds/api/videos/{0}", id));

            try {
                var video = request.Retrieve<Video>(videoEntryUrl);
                var thumbUrl = video.Thumbnails.Count > 0 ? video.Thumbnails[0].Url : string.Empty;
                return VideoTitleParseResult.CreateSuccess(video.Title, video.Author, thumbUrl);
            } catch (Exception x) {
                return VideoTitleParseResult.CreateError(x.Message);
            }
        }
开发者ID:realzhaorong,项目名称:vocadb,代码行数:14,代码来源:YoutubeParser.cs


示例18: GetVideo

        public override VideoResponse GetVideo(VideoRequest videoRequest)
        {
            Uri videoUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoRequest.VideoId);

            try
            {
                var request = new YouTubeRequest(new YouTubeRequestSettings(Application, ApiKey));
                var video = request.Retrieve<Video>(videoUrl);
                return new VideoResponse() { Video = video };
            }
            catch (Exception e)
            {
                return new VideoResponse() { Video = null };
            }
        }
开发者ID:pjmagee,项目名称:SpikeLite,代码行数:15,代码来源:YouTubeService.cs


示例19: MainX

        // once you copied your access and refresh tokens
        // then you can run this method directly from now on...
        public void MainX(string args)
        {
            GOAuth2RequestFactory requestFactory = RefreshAuthenticate();
            YouTubeRequestSettings settings = new YouTubeRequestSettings(_app_name, _clientID, _devKey);
            YouTubeRequest request = new YouTubeRequest(settings);

            YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri);
            //order results by the number of views (most viewed first)
            query.OrderBy = "viewCount";
            // search for puppies and include restricted content in the search results
            // query.SafeSearch could also be set to YouTubeQuery.SafeSearchValues.Moderate
            query.Query = args;
            query.SafeSearch = YouTubeQuery.SafeSearchValues.None;
            //Feed<Video> videoFeed = requestFactory.Get<Video>(query);
        }
开发者ID:juress,项目名称:ytmusic,代码行数:17,代码来源:search.cs


示例20: GetRequest

 public static YouTubeRequest GetRequest()
 {
     YouTubeRequest request = HttpContext.Current.Session["YTRequest"] as YouTubeRequest;
     if (request == null)
     {
         YouTubeRequestSettings settings = new YouTubeRequestSettings("YouTubeAspSample",
                                         "AI39si4v3E6oIYiI60ndCNDqnPP5lCqO28DSvvDPnQt-Mqia5uPz2e4E-gMSBVwHXwyn_LF1tWox4LyM-0YQd2o4i_3GcXxa2Q",
                                         HttpContext.Current.Session["token"] as string
                                         );
         settings.AutoPaging = true;
         request = new YouTubeRequest(settings);
         HttpContext.Current.Session["YTRequest"] = request;
     }
     return request;
 }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:15,代码来源:ListVideos.cs



注:本文中的YouTubeRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# YouTubeRequestSettings类代码示例发布时间:2022-05-24
下一篇:
C# YieldTermStructureHandle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap