【问题标题】:I can't get video on youtube by channel.Why?我无法通过频道在 youtube 上获取视频。为什么?
【发布时间】:2015-08-17 22:20:06
【问题描述】:

https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ

public async System.Threading.Tasks.Task<List<ViewModel.YoutubeVideo>> GetYoutubeMusic()
    {
        var youtubeService = new YouTubeService(new BaseClientService.Initializer()
        {
            ApiKey = "....",
            ApplicationName = this.GetType().ToString()
        });


        var searchListRequest = youtubeService.Channels.List("snippet");
        searchListRequest.Id= "UC-9-kyTW8ZkZNDHQJ6FgpwQ";
        searchListRequest.MaxResults = 25;



        //Call the search.list method to retrieve results...
        var searchListResponse = await searchListRequest.ExecuteAsync();
        List<ViewModel.YoutubeVideo> arrays = new List<ViewModel.YoutubeVideo>();
        foreach (var searchResult in searchListResponse.Items)
        {
            product = new ViewModel.YoutubeVideo();
            product.id = searchResult.Id;
            product.Name = searchResult.Snippet.Title;
            product.Thumb100Uri = searchResult.Snippet.Thumbnails.Default.Url;
            product.Thumb200Uri = searchResult.Snippet.Thumbnails.Medium.Url;
            arrays.Add(product);

        }

        return arrays;
    }

只是从这个频道获取信息,但没有视频... 我不明白这一点。请解决。

【问题讨论】:

    标签: c# wpf youtube youtube-api


    【解决方案1】:

    因为您没有调用 search.list 方法。您正在代码中调用 channels.list 方法。

    但如果你已经有了频道的 id,你应该只需要retrieve that channel's uploaded videos

    【讨论】:

      猜你喜欢
      • 2019-10-06
      • 2018-10-02
      • 2012-10-05
      • 2023-04-03
      • 2019-02-28
      • 2019-05-21
      • 2021-03-13
      • 2012-03-22
      • 2012-10-24
      相关资源
      最近更新 更多