YouTube Direct Method Service Unavailable
Posted in APIs on September 30th, 2009 by Saba – 1 CommentI am running into issues on Uploading and viewing a feed and displaying a site I am receiving Service Unavailable and unable to display the feed.
Below is my code:
Protected Sub TestMe1()
Dim developerkey = “AI39si4SeOiZv1ex3s6mfRLLycYbOBZQB03k29A4nrZ4I3JxUj3jhQdJpAjv5GUJIM_C9j7cF8ep2Zl3wZprpFqmWAx5cEdWbw”
Dim settings As New YouTubeRequestSettings(“example app”, “testapp”, developerkey, “mybeemd”, “Carrieann1″) Dim request1 As New YouTubeRequest(settings)
Dim uri As New Uri(“http://gdata.youtube.com/feeds/api/users/ mybeemd/uploads”) Dim videoFeed As Feed(Of Video) = request1.[Get](Of Video) (uri)
Dim ds As New DataSet() ds = New DataSet
ds.Tables.Add(printVideoFeed(videoFeed))
dlYoutube.DataSource = ds.Tables(0) dlYoutube.DataBind()
End Sub
Private Function printVideoFeed(ByVal feed As Feed(Of Video)) As DataTable Dim strResponse As String = “” Dim strVideoState As String = “”
Dim Table1 As DataTable Table1 = New DataTable(“YouTubeCollection”) ‘creating a table named Customers Dim Row1, Row2, Row3 As DataRow ‘declaring three rows for the table
Dim ImageURL As DataColumn = New DataColumn(“ImageURL”) ‘declaring a column named Name ImageURL.DataType = System.Type.GetType(“System.String”) ’setting the datatype for the column Table1.Columns.Add(ImageURL) ‘adding the column to table Dim strTitle As DataColumn = New DataColumn(“Title”) strTitle.DataType = System.Type.GetType(“System.String”) Table1.Columns.Add(strTitle) Dim ViewCount As DataColumn = New DataColumn(“ViewCount”) ViewCount.DataType = System.Type.GetType(“System.String”) Table1.Columns.Add(ViewCount) Dim strAuthor As DataColumn = New DataColumn(“Author”) strAuthor.DataType = System.Type.GetType(“System.String”) Table1.Columns.Add(strAuthor)
Try
For Each entry As Video In feed.Entries
Dim x As Int32 = 0 If entry.IsDraft = False Then Row1 = Table1.NewRow() For Each thumbnail As MediaThumbnail In entry.Thumbnails If x = 1 Then Row1.Item(“ImageURL”) = thumbnail.Url End If x += 1 Next Row1.Item(“Title”) = entry.Title Row1.Item(“ViewCount”) = entry.ViewCount Row1.Item(“Author”) = entry.Author ’strResponse &= “” & entry.Title & “
” ’strResponse &= “Description ” & entry.Description & “
” ’strResponse &= “View Count ” & entry.ViewCount & “
” ’strResponse &= “Thumbnails:
”
’strResponse &= “
”
Else
End If
strVideoState = “”
‘Set Counter x = 0 x = 0
Table1.Rows.Add(Row1)
Row1 = Nothing Next
Catch ex As Exception
Response.Write(ex.Message.ToString & ” Please try again later”)
End Try
Return Table1 End Function
The “testme” function is being called on the page load.