2011-12-19 150 views
0

我在那對用戶進行認證,並試圖檢索當前認證的用戶播放列表,但是要求是inavlid和錯誤是因爲這樣的時刻這段代碼檢索用戶的播放列表使用YouTube API

的要求執行失敗:
http://gdata.youtube.com/feeds/api/users/[email protected]/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 
+0

難道是用的用戶名這樣做,因爲它使用特定的字符,也許我需要來urlencode – redoc01 2011-12-19 13:52:38

回答

0
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