当前位置: 首页>>代码示例>>C#>>正文


C# YouTubeRequest类代码示例

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


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


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