如何在Visual Basic 2012中显示YouTubers订阅者计数?

时间:2013-06-14 19:04:42

标签: vb.net winforms youtube-api

我想要一个显示youtuber订阅者数量的表单。我已经安装了API,我得到了这段代码:

Imports Google.GData.YouTube
Imports Google.GData.Client
Imports Google.GData.Extensions

Public Class Form1

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim subshelper As New Service
        Dim feedUrl As String = "http://gdata.youtube.com/feeds/api/users/SkyDoesMinecraft"
        Dim profile As ProfileEntry = subshelper.Get(feedUrl)
        Dim subscount As Integer = profile.Statistics.SubscriberCount

        Label1.Text = subscount
    End Sub
End Class

我收到了这个错误:

An unhandled exception of type 'Google.GData.Client.GDataRequestException' occurred in Google.GData.Client.dll

Additional information: Execution of request failed:
https://gdata.youtube.com/feeds/api/users/SkyDoesMinecraft

有人可以帮我吗?谢谢!

1 个答案:

答案 0 :(得分:0)

如果您关注的事情是使用YouTube数据API来获取该频道的订阅者数量,那么您最好的选择可能只是制作generic HTTP request(没有

使用任何GData库)
https://gdata.youtube.com/feeds/api/users/SkyDoesMinecraft?v=2&alt=json

然后使用JSON-parsing library读取yt$statistics - >的值subscriberCount