【问题标题】:Retrieve user playlist using YouTube API使用 YouTube API 检索用户播放列表
【发布时间】:2011-12-19 13:36:10
【问题描述】:

我现在有这段代码验证用户并尝试检索当前经过验证的用户播放列表,但请求无效并且错误是这样

请求执行失败:
http://gdata.youtube.com/feeds/api/users/xx_xxx_x@hotmail.com/playlists

Public Function GetRequest(ByVal username As String, ByVal password As String) As YouTubeRequest
  Dim youtubeSettings = New YouTubeRequestSettings("test", DeveloperKey, username, password)
  Dim youtubeRequest As New YouTubeRequest(youtubeSettings)
  Return youtubeRequest
End Function

Public Function GetUserPlaylists(ByVal username As String, ByVal password As String)
  Dim youtubeRequest As YouTubeRequest = Me.GetRequest(username, password)
  Try
    Dim userPlaylists As Feed(Of Playlist) = youtubeRequest.GetPlaylistsFeed(username)

    If True Then
    End If
  Catch ex As Exception
  End Try
End Function

【问题讨论】:

  • 可能与用户名有关,因为它使用特定字符,也许我需要 urlencode

标签: asp.net .net youtube youtube-api


【解决方案1】:
Dim youtubeRequest As YouTubeRequest = Me.GetRequest(username, password)

        Dim url As String = "https://gdata.youtube.com/feeds/api/users/default/playlists?v=2"

        Try

            Dim feedQuery As New FeedQuery(url)
            Dim userPlaylists As Feed(Of Playlist) = youtubeRequest.Get(Of Playlist)(feedQuery)

            If True Then

            End If


        Catch ex As Exception

        End Try

    End Function

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-19
    • 2020-12-04
    • 1970-01-01
    • 2011-12-11
    • 2014-04-04
    • 1970-01-01
    相关资源
    最近更新 更多