0
谢谢,我非常感谢您的帮助!Google API DotNet Youtube播放列表失败,无播放列表ID
我想让.NET的Google API客户端正常工作,但我不知道如何做甚至简单的事情。我的目标是建立一个网页,在顶部加载一个YouTube播放列表播放器,并只列出其下方其他曲目的相关信息。
你能帮我解决一下让客户端运行的第一个问题吗?
我有一个.NET 4.0网站实例,我已经通过nuget软件包管理器安装了DotNet Google API。我认为问题在于我无法弄清楚如何将PlaylistID传递给客户端请求。在下面的代码中,我可以指定PlaylistID?
Imports Google.Apis.YouTube.v3
Imports Google.Apis.YouTube.v3.Data
Dim Initialiser As New Google.Apis.Services.BaseClientService.Initializer()
Initialiser.ApiKey = "My Server API Key"
Dim Service As YouTubeService = New YouTubeService(Initialiser)
Dim Result As PlaylistItemListResponse
Result = Service.PlaylistItems().List("snippet").Execute()
If Not Result.Items Is Nothing Then
Dim XPathDocument As System.Xml.XPath.XPathDocument = GenerateXPathDocument(Result.Items)
SamplerXml.XPathNavigator = XPathDocument.CreateNavigator
End If
错误输出是:
2014-01-21 12:14:30.1894 Error ASP.global_asax
Application_Error: GET /sampler/120
BaseExceptionType: Google.GoogleApiException
Type=System.Web.HttpUnhandledException
Message=Exception of type 'System.Web.HttpUnhandledException' was thrown.
Stack=
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.templates_sampler_default_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Type=Google.GoogleApiException
Message=Google.Apis.Requests.RequestError
No filter selected. [400]
Errors [
Message[No filter selected.] Location[ - parameter] Reason[missingRequiredParameter] Domain[youtube.parameter]
]
Stack=
at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\output\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 93
at SiteCode.Templates.Sampler.Page_Load(Object sender, EventArgs e) in C:\svn-work\playlistproject\site\templates\sampler\Default.aspx.vb:line 54
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
谢谢您的帮助和您的时间!