get viewCount of my youtube video RRS feed

  • Question

  • User944339287 posted

    hi guys. I was referring to the following URL in order to get [videoCount] of my youtube video.

    I should able to get viewCount by using entry(("statistics")("viewCount").ToString()

    *FYI,  entry("snippet")("title").ToString() is working as expected.

    Below is my code:

                    Dim jsonstring As String = wc.DownloadString("https://www.googleapis.com/youtube/v3/videos?part=snippet&id=" & Request.QueryString("videoId").ToString.Trim & "&key=" & key)
                    Dim jobj As JObject = CType(JsonConvert.DeserializeObject(jsonstring), JObject)
                    For Each entry In jobj("items")
                        DT.Rows.Add(entry("snippet")("title").ToString(), entry("statistics")("viewCount").ToString())
                Catch ex As Exception
                End Try

    Wednesday, January 22, 2020 10:03 AM


  • User753101303 posted


    Use part=snippet,statistics to ask also for statistics.

    Standard debugging should help ie if you look at the payload and see you don't have this info, you can then understood and look at how to request them in the response...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 22, 2020 10:20 AM