作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
谢谢你,我真的很感谢你的帮助!
我正在尝试让 .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)
最佳答案
答案很简单。
Dim Initialiser As New Google.Apis.Services.BaseClientService.Initializer()
Initialiser.ApiKey = "My API Key"
Dim Service As Google.Apis.YouTube.v3.YouTubeService = New YouTubeService(Initialiser)
Dim Result As Google.Apis.YouTube.v3.Data.PlaylistItemListResponse
Dim ListRequest As Google.Apis.YouTube.v3.PlaylistItemsResource.ListRequest
ListRequest = Service.PlaylistItems().List("snippet")
ListRequest.PlaylistId = "My Playlist ID"
Result = ListRequest.Execute()
If Not Result.Items Is Nothing Then
Dim XPathDocument As System.Xml.XPath.XPathDocument = GenerateXPathDocument(Result.Items)
SamplerXml.XPathNavigator = XPathDocument.CreateNavigator
End If
关于.net - Google API DotNet Youtube 播放列表失败,没有 PlaylistID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21268500/
谢谢你,我真的很感谢你的帮助! 我正在尝试让 .NET Google API 客户端工作,但我什至无法弄清楚如何做一些简单的事情。我的目标是有一个网页,在顶部加载一个 youtube 播放列表播放器,
我正在尝试根据 channel 的 channel ID 找出获取 channel 上传播放列表 ID 的最佳方法。例如。对于具有 channelID 的 channel UC9CuvdOVfMPvK
我正在尝试做我认为在 Android 应用程序中很简单的任务。我希望能够开始播放 YouTube 播放列表,如下所示: String PLAYLIST_ID = "PLF3DFB800F05F551
我是一名优秀的程序员,十分优秀!