2014-11-05 44 views
0

我在.NET MVC中使用了Google.Apis.Youtube.v3插件。從搜索結果中獲取特定於用戶的視頻

var service = _youTubeService.GetYouTubeService; 
var searchReq = service.Search.List("snippet"); 
searchReq.ChannelId = "exampleIdGoesHere"; // search this channel 
searchReq.Q = "acoustic"; // search term 

var model = new YouTubeViewModel { 
    Data = searchReq.Execute().Items 
} 

return View(model); 

在我看來,我的目標是嵌入視頻。但到目前爲止,我能得到的唯一相關信息是搜索結果的標題和說明。這些物品,每個物品都是SearchResult,並不完全是Video - 我正在尋找。

有兩個問題: - 如何檢索僅來自特定用戶的視頻(使用.NET插件)? - 你如何獲得視頻信息,如URL,用於嵌入目的?

+0

https://developers.google.com/youtube/2.0/developers_guide_protocol_api_query_parameters – 2014-11-05 17:59:09

+0

@LB嗨!是的,我在API網站上已經有相當長的一段時間了,但我還沒有找到讓插件以我想要的方式工作的方式。這似乎不完整在這一點 – 2014-11-05 18:58:35

回答

0

要使用v3獲取特定頻道的所有視頻,您需要執行以下步驟。

  1. 獲取頻道上傳播放列表ID。你得到的播放列表使用playlistItems呼叫

從那裏你可以創建一個使用「https://www.youtube.com/watch?v=」 +視頻的視頻網址這個使用Channels list呼叫

  • 然後獲得在上傳的視頻列表獲取。 Id

  • +0

    嗨,感謝您的迴應,但我正在尋找一個特定的用戶,而不是頻道的視頻。 =) – 2014-12-18 14:20:38

    相關問題