{
"kind": "youtube#playlistItemListResponse",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/YJYLWeQ7ZaYKr3ce1Z9EIjD9WVU\"",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 10,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#playlistItem",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/0TyxpFnbR5GigaSoRo2gAPfUHwE\"",
"id": "UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41NkI0NEY2RDEwNTU3Q0M2",
"snippet": {
"publishedAt": "2014-12-10T21:16:39.000Z",
"channelId": "UCVUx0VcNxnHx7ZjuZK5Sthw",
"title": "Private video",
"description": "This video is private.",
"channelTitle": "Late Show with David Letterman",
"playlistId": "PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk",
"position": 0,
"resourceId": {
"kind": "youtube#video",
"videoId": "4bVgilYncao"
}
}
},
{
"kind": "youtube#playlistItem",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/PVF3VoVEG0X1jmV6GeUNhpCIzF4\"",
"id": "UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4yODlGNEE0NkRGMEEzMEQy",
"snippet": {
"publishedAt": "2014-12-10T21:16:58.000Z",
"channelId": "UCVUx0VcNxnHx7ZjuZK5Sthw",
"title": "Private video",
"description": "This video is private.",
"channelTitle": "Late Show with David Letterman",
"playlistId": "PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk",
"position": 1,
"resourceId": {
"kind": "youtube#video",
"videoId": "H9eYkpgeeI8"
}
}
},
{
"kind": "youtube#playlistItem",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/BLUJWU0eHjBeEizXySdnzUhi2lQ\"",
"id": "UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wMTcyMDhGQUE4NTIzM0Y5",
"snippet": {
"publishedAt": "2014-12-10T21:17:14.000Z",
"channelId": "UCVUx0VcNxnHx7ZjuZK5Sthw",
"title": "Private video",
"description": "This video is private.",
"channelTitle": "Late Show with David Letterman",
"playlistId": "PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk",
"position": 2,
"resourceId": {
"kind": "youtube#video",
"videoId": "ONgN2Hgz3XE"
}
}
},
{
"kind": "youtube#playlistItem",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/qlX2iXH1WPg7D3-eq7jInjQyj2c\"",
"id": "UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41MjE1MkI0OTQ2QzJGNzNG",
"snippet": {
"publishedAt": "2014-12-10T21:17:30.000Z",
"channelId": "UCVUx0VcNxnHx7ZjuZK5Sthw",
"title": "Private video",
"description": "This video is private.",
"channelTitle": "Late Show with David Letterman",
"playlistId": "PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk",
"position": 3,
"resourceId": {
"kind": "youtube#video",
"videoId": "1Ee4bfu_t3c"
}
}
},
{
"kind": "youtube#playlistItem",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/698H3tj04Cx7lZ8z4rHjL4DPtUI\"",
"id": "UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wOTA3OTZBNzVEMTUzOTMy",
"snippet": {
"publishedAt": "2014-12-10T21:17:47.000Z",
"channelId": "UCVUx0VcNxnHx7ZjuZK5Sthw",
"title": "Private video",
"description": "This video is private.",
"channelTitle": "Late Show with David Letterman",
"playlistId": "PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk",
"position": 4,
"resourceId": {
"kind": "youtube#video",
"videoId": "Bzr5VtFvSyw"
}
}
}
]
}
' Newtonsoft.Json
Dim n As New WebClient()
Dim jsonString As String = n.DownloadString("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2C+id&playlistId=PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk&key=YOUR_API_KEY_HERE")
Dim jo = Newtonsoft.Json.Linq.JObject.Parse(jsonString)
Dim VidID = jo("items")(0)("snippet")("resourceId")("videoId")
For Each Row In jo("items")
Response.Write(VidID)
Next
{
"items": [
{
"id": "7Ms3vgQA6yg",
"snippet": {
"channelId": "UCwrBbNtAINY8W2PGNQlSuZw",
"title": "Visual studio 2010 - vb.net Lesson #4 - Insert data into Access Database",
"categoryId": "27"
},
"statistics": {
"viewCount": "4",
"likeCount": "0",
"dislikeCount": "0",
"favoriteCount": "0",
"commentCount": "0"
}
}
]
}
Private Sub InsertPlayList(ByVal playList As PlayList)
Dim playListId = -1
Dim pageInfoId = -1
Dim snippetId = -1
Dim resourceId = -1
Using connection = New SqlConnection("yourconnectionstring")
Using command = New SqlCommand("INSERT INTO dbo.PageInfo (TOTALRESULTS,RESULTSPERPAGE) VALUES (@TOTALRESULTS,@RESULTSPERPAGE)", connection)
command.Parameters.AddWithValue("@TOTALRESULTS", playList.PageInfo.TotalResults)
command.Parameters.AddWithValue("@RESULTSPERPAGE", playList.PageInfo.ResultsPerPage)
pageInfoId = CType(command.ExecuteScalar(), Integer)
End Using
Using command = New SqlCommand("INSERT INTO dbo.PlayList (KIND,ETAG,NEXTPAGETOKEN,PAGEINFOID) VALUES (@KIND,@ETAG,@NEXTPAGETOKEN,@PAGEINFOID)", connection)
command.Parameters.AddWithValue("@KIND", playList.Kind)
command.Parameters.AddWithValue("@ETAG", playList.ETag)
command.Parameters.AddWithValue("@NETPAGETOKEN", playList.NextPageToken)
command.Parameters.AddWithValue("@PAGEINFOID", pageInfoId)
playListId = CType(command.ExecuteScalar(), Integer)
End Using
For Each [item] In playList.Items
Using command = New SqlCommand("INSERT INTO dbo.ResourceID (KIND,VIDEOID) VALUES (@KIND,@VIDEOID)", connection)
command.Parameters.AddWithValue("@KIND", item.Snippet.ResourceId.Kind)
command.Parameters.AddWithValue("@VIDEOID", item.Snippet.ResourceId.VideoId)
resourceId = CType(command.ExecuteScalar(), Integer)
End Using
Using command = New SqlCommand("INSERT INTO dbo.Snippet (PUBLISHEDAT,CHANNELID,TITLE,DESCRIPTION,CHANNELTITLE,PLAYLISTID,POSITION,RESOURCEID) VALUES (@PUBLISHEDAT,@CHANNELID,@TITLE,@DESCRIPTION,@CHANNELTITLE,@PLAYLISTID,@POSITION,@RESOURCEID)", connection)
command.Parameters.AddWithValue("@PUBLISHEDAT", item.Snippet.PublishedAt)
command.Parameters.AddWithValue("@CHANNELID", item.Snippet.ChannelId)
command.Parameters.AddWithValue("@TITLE", item.Snippet.Title)
command.Parameters.AddWithValue("@DESCRIPTION", item.Snippet.Description)
command.Parameters.AddWithValue("@CHANNELTITLE", item.Snippet.ChannelTitle)
command.Parameters.AddWithValue("@PLAYLISTID", item.Snippet.PlayListId)
command.Parameters.AddWithValue("@POSITION", item.Snippet.Position)
command.Parameters.AddWithValue("@RESOURCEID", resourceId)
snippetId = CType(command.ExecuteScalar(), Integer)
End Using
Using command = New SqlCommand("INSERT INTO dbo.Item (PLAYLISTID,KIND,ETAG,ID,SNIPPETID) VALUES (@PLAYLISTID,@KIND,@ETAG,@ID,@SNIPPETID)", connection)
command.Parameters.AddWithValue("@PLAYLISTID", playListId)
command.Parameters.AddWithValue("@KIND", [item].Kind)
command.Parameters.AddWithValue("@ETAG", [item].ETag)
command.Parameters.AddWithValue("@ID", [item].Id)
command.Parameters.AddWithValue("@SNIPPETID", snippetId)
command.ExecuteScalar()
End Using
Next
End Using
End Sub
-saige-
{
"nextPageToken": "CDMQAA",
"prevPageToken": "CDIQAQ",
"pageInfo": {
"totalResults": 83,
"resultsPerPage": 1
},
"items": [
{
"id": "PLoGpay6XnQnQPjBAntJCpVFzAFg-RwJ9S",
"snippet": {
"publishedAt": "2013-05-19T00:55:32.000Z",
"channelId": "UC0crFgTrPx5t6YM2NumtFoA",
"title": "Adobe Premiere",
"description": "",
"thumbnails": {
"standard": {
"url": "https://i.ytimg.com/vi/WJaT1vLKDPc/default.jpg"
}
},
"channelTitle": "Dark Effects Studios"
},
"contentDetails": {
"itemCount": 9
}
}
]
}
(I got the itemCount, that was simple) Class Snippet
Public Property PublishedAt() As String
Public Property ChannelId() As String
Public Property Title() As String
Public Property Description() As String
Public Property ChannelTitle() As String
Public Property PlayListId() As String
Public Property Position() As Integer
Public Property thumbnails() As thumbnails
End Class
Class thumbnails
Public Property standard() As standard
End Class
Class standard
Public Property url() As String
End Class
item.Snippet.thumbnails.standard.url
{
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/hnhmasSCjJz0vBS08sQUDwgwTIQ\"",
"id": "FL0crFgTrPx5t6YM2NumtFoA",
"snippet": {
"publishedAt": "2011-05-14T11:05:40.000Z",
"channelId": "UC0crFgTrPx5t6YM2NumtFoA",
"title": "Favorites",
"description": "",
"channelTitle": "Dark Effects Studios"
},
"contentDetails": {
"itemCount": 6
}
}
Imports System.Data.SqlClient
Module Module1
Const json = "{" _
& """kind"": ""youtube#playlistItemListResponse"", " _
& """etag"" : ""\""m2yskBQFythfE4irbTIeOgYYfBU/YJYLWeQ7ZaYKr3ce1Z9EIjD9WVU\"""", " _
& """nextPageToken"": ""CAUQAA"", " _
& """pageInfo"": {""totalResults"": 10,""resultsPerPage"": 5}, " _
& """items"": [" _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/0TyxpFnbR5GigaSoRo2gAPfUHwE\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41NkI0NEY2RDEwNTU3Q0M2"",""snippet"": {""publishedAt"": ""2014-12-10T2116:39.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {""url"": ""https://i.ytimg.com/vi/WJaT1vLKDPc/default.jpg""}},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 0,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""4bVgilYncao""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/PVF3VoVEG0X1jmV6GeUNhpCIzF4\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4yODlGNEE0NkRGMEEzMEQy"",""snippet"": {""publishedAt"": ""2014-12-10T2116:58.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 1,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""H9eYkpgeeI8""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/BLUJWU0eHjBeEizXySdnzUhi2lQ\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wMTcyMDhGQUE4NTIzM0Y5"",""snippet"": {""publishedAt"": ""2014-12-10T2117:14.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 2,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""ONgN2Hgz3XE""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/qlX2iXH1WPg7D3-eq7jInjQyj2c\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41MjE1MkI0OTQ2QzJGNzNG"",""snippet"": {""publishedAt"": ""2014-12-10T2117:30.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {}},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 3,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""1Ee4bfu_t3c""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/698H3tj04Cx7lZ8z4rHjL4DPtUI\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wOTA3OTZBNzVEMTUzOTMy"",""snippet"": {""publishedAt"": ""2014-12-10T2117:47.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {""url"": null }},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 4,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""Bzr5VtFvSyw""}}}]}"
Sub Main()
Dim playList = Newtonsoft.Json.JsonConvert.DeserializeObject(Of PlayList)(json)
Console.WriteLine("Kind: " & playList.Kind)
Console.WriteLine("ETag: " & playList.ETag)
Console.WriteLine("NextPageToken: " & playList.NextPageToken)
Console.WriteLine("PageInfo:")
Console.WriteLine(vbTab & "Total Results: " & playList.PageInfo.TotalResults)
Console.WriteLine(vbTab & "ResultsPerPage: " & playList.PageInfo.ResultsPerPage)
Console.WriteLine("Items:")
For Each [item] In playList.Items
Console.WriteLine(vbTab & "Kind: " & [item].Kind)
Console.WriteLine(vbTab & "ETag: " & [item].ETag)
Console.WriteLine(vbTab & "Id: " & [item].Id)
Console.WriteLine(vbTab & "Snippet:")
Console.WriteLine(vbTab & vbTab & "PublishedAt: " & [item].Snippet.PublishedAt)
Console.WriteLine(vbTab & vbTab & "ChannelId: " & [item].Snippet.ChannelId)
Console.WriteLine(vbTab & vbTab & "Description: " & [item].Snippet.Description)
Console.WriteLine(vbTab & vbTab & "ChannelTitle: " & [item].Snippet.ChannelTitle)
Console.WriteLine(vbTab & vbTab & "PlayListId: " & [item].Snippet.PlayListId)
Console.WriteLine(vbTab & vbTab & "Position: " & [item].Snippet.Position)
Console.WriteLine(vbTab & vbTab & "ResourceId:")
Console.WriteLine(vbTab & vbTab & vbTab & "Kind: " & [item].Snippet.ResourceId.Kind)
Console.WriteLine(vbTab & vbTab & vbTab & "VideoId: " & [item].Snippet.ResourceId.VideoId)
If [item].Snippet.Thumbnails IsNot Nothing Then
Console.WriteLine(vbTab & vbTab & "Thumbnails:")
If [item].Snippet.Thumbnails.Standard IsNot Nothing Then
Console.WriteLine(vbTab & vbTab & vbTab & "Standard:")
If [item].Snippet.Thumbnails.Standard.Url IsNot Nothing Then
Console.WriteLine(vbTab & vbTab & vbTab & vbTab & "Url: " & [item].Snippet.Thumbnails.Standard.Url)
End If
End If
End If
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Class PlayList
Public Property Kind() As String
Public Property ETag() As String
Public Property NextPageToken() As String
Public Property PageInfo() As PageInfo
Public Property Items() As List(Of Item)
End Class
Class Item
Public Property Kind() As String
Public Property ETag() As String
Public Property Id() As String
Public Property Snippet() As Snippet
End Class
Class PageInfo
Public Property TotalResults() As Integer
Public Property ResultsPerPage() As Integer
End Class
Class Snippet
Public Property PublishedAt() As String
Public Property ChannelId() As String
Public Property Title() As String
Public Property Description() As String
Public Property ChannelTitle() As String
Public Property PlayListId() As String
Public Property Position() As Integer
Public Property ResourceId() As ResourceId
Public Property Thumbnails() As Thumbnails
End Class
Class Thumbnails
Public Property Standard() As Standard
End Class
Class Standard
Public Property Url() As String
End Class
Class ResourceId
Public Property Kind() As String
Public Property VideoId() As String
End Class
Class PlayList
Dim _kind As String = String.Empty
Dim _eTag As String = String.Empty
Dim _nextPageToken As String = String.Empty
Dim _pageInfo As PageInfo = New PageInfo()
Dim _items As List(Of Item) = New List(Of Item)()
Property Kind() As String
Get
Return _kind
End Get
Set
_kind = Value
End Set
End Property
Property ETag() As String
Get
Return _eTag
End Get
Set
_eTag = Value
End Set
End Property
Property NextPageToken() As String
Get
Return _nextPageToken
End Get
Set
_nextPageToken = Value
End Set
End Property
Property PageInfo() As PageInfo
Get
Return _pageInfo
End Get
Set
_pageInfo = Value
End Set
End Property
Property Items() As List(Of Item)
Get
Return _items
End Get
Set
_items = Value
End Set
End Property
End Class
VB.NET also allows for us to set the default value on the auto-implemented property itself (C# does not):
Class PlayList
Public Property Kind() As String = String.Empty
Public Property ETag() As String = String.Empty
Public Property NextPageToken() As String = String.Empty
Public Property PageInfo() As PageInfo = New PageInfo()
Public Property Items() As List(Of Item) = New List(Of Item)()
End Class
Imports System.Data.SqlClient
Module Module1
Const json = "{" _
& """kind"": ""youtube#playlistItemListResponse"", " _
& """etag"" : ""\""m2yskBQFythfE4irbTIeOgYYfBU/YJYLWeQ7ZaYKr3ce1Z9EIjD9WVU\"""", " _
& """nextPageToken"": ""CAUQAA"", " _
& """pageInfo"": {""totalResults"": 10,""resultsPerPage"": 5}, " _
& """items"": [" _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/0TyxpFnbR5GigaSoRo2gAPfUHwE\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41NkI0NEY2RDEwNTU3Q0M2"",""snippet"": {""publishedAt"": ""2014-12-10T2116:39.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {""url"": ""https://i.ytimg.com/vi/WJaT1vLKDPc/default.jpg""}},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 0,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""4bVgilYncao""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/PVF3VoVEG0X1jmV6GeUNhpCIzF4\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4yODlGNEE0NkRGMEEzMEQy"",""snippet"": {""publishedAt"": ""2014-12-10T2116:58.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 1,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""H9eYkpgeeI8""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/BLUJWU0eHjBeEizXySdnzUhi2lQ\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wMTcyMDhGQUE4NTIzM0Y5"",""snippet"": {""publishedAt"": ""2014-12-10T2117:14.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 2,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""ONgN2Hgz3XE""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/qlX2iXH1WPg7D3-eq7jInjQyj2c\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay41MjE1MkI0OTQ2QzJGNzNG"",""snippet"": {""publishedAt"": ""2014-12-10T2117:30.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {}},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 3,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""1Ee4bfu_t3c""}}}," _
& "{""kind"": ""youtube#playlistItem"",""etag"": ""\""m2yskBQFythfE4irbTIeOgYYfBU/698H3tj04Cx7lZ8z4rHjL4DPtUI\"""",""id"": ""UExDSkxpSjh1U0pyQ3B4d3o0bG1uejFOdnZGMlN6WGJoay4wOTA3OTZBNzVEMTUzOTMy"",""snippet"": {""publishedAt"": ""2014-12-10T2117:47.000Z"",""channelId"": ""UCVUx0VcNxnHx7ZjuZK5Sthw"",""title"": ""Private video"",""description"": ""This video Is private."",""thumbnails"": {""standard"": {""url"": null }},""channelTitle"": ""Late Show with David Letterman"",""playlistId"": ""PLCJLiJ8uSJrCpxwz4lmnz1NvvF2SzXbhk"",""position"": 4,""resourceId"": {""kind"": ""youtube#video"",""videoId"": ""Bzr5VtFvSyw""}}}]}"
Sub Main()
Dim playList = Newtonsoft.Json.JsonConvert.DeserializeObject(Of PlayList)(json)
Console.WriteLine("Kind: " & playList.Kind)
Console.WriteLine("ETag: " & playList.ETag)
Console.WriteLine("NextPageToken: " & playList.NextPageToken)
Console.WriteLine("PageInfo:")
Console.WriteLine(vbTab & "Total Results: " & playList.PageInfo.TotalResults)
Console.WriteLine(vbTab & "ResultsPerPage: " & playList.PageInfo.ResultsPerPage)
Console.WriteLine("Items:")
For Each [item] In playList.Items
Console.WriteLine(vbTab & "Kind: " & [item].Kind)
Console.WriteLine(vbTab & "ETag: " & [item].ETag)
Console.WriteLine(vbTab & "Id: " & [item].Id)
Console.WriteLine(vbTab & "Snippet:")
Console.WriteLine(vbTab & vbTab & "PublishedAt: " & [item].Snippet.PublishedAt)
Console.WriteLine(vbTab & vbTab & "ChannelId: " & [item].Snippet.ChannelId)
Console.WriteLine(vbTab & vbTab & "Description: " & [item].Snippet.Description)
Console.WriteLine(vbTab & vbTab & "ChannelTitle: " & [item].Snippet.ChannelTitle)
Console.WriteLine(vbTab & vbTab & "PlayListId: " & [item].Snippet.PlayListId)
Console.WriteLine(vbTab & vbTab & "Position: " & [item].Snippet.Position)
Console.WriteLine(vbTab & vbTab & "ResourceId:")
Console.WriteLine(vbTab & vbTab & vbTab & "Kind: " & [item].Snippet.ResourceId.Kind)
Console.WriteLine(vbTab & vbTab & vbTab & "VideoId: " & [item].Snippet.ResourceId.VideoId)
Console.WriteLine(vbTab & vbTab & "Thumbnails:")
Console.WriteLine(vbTab & vbTab & vbTab & "Standard:")
Console.WriteLine(vbTab & vbTab & vbTab & vbTab & "Url: " & [item].Snippet.Thumbnails.Standard.Url)
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Class PlayList
Public Property Kind() As String = String.Empty
Public Property ETag() As String = String.Empty
Public Property NextPageToken() As String = String.Empty
Public Property PageInfo() As PageInfo = New PageInfo()
Public Property Items() As List(Of Item) = New List(Of Item)()
End Class
Class Item
Public Property Kind() As String = String.Empty
Public Property ETag() As String = String.Empty
Public Property Id() As String = String.Empty
Public Property Snippet() As Snippet = New Snippet()
End Class
Class PageInfo
Public Property TotalResults() As Integer = -1
Public Property ResultsPerPage() As Integer = -1
End Class
Class Snippet
Public Property PublishedAt() As String = String.Empty
Public Property ChannelId() As String = String.Empty
Public Property Title() As String = String.Empty
Public Property Description() As String = String.Empty
Public Property ChannelTitle() As String = String.Empty
Public Property PlayListId() As String = String.Empty
Public Property Position() As Integer = -1
Public Property ResourceId() As ResourceId = New ResourceId()
Public Property Thumbnails() As Thumbnails = New Thumbnails()
End Class
Class Thumbnails
Public Property Standard() As Standard = New Standard()
End Class
Class Standard
Public Property Url() As String = String.Empty
End Class
Class ResourceId
Public Property Kind() As String = String.Empty
Public Property VideoId() As String = String.Empty
End Class
{
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/7NLyhJdgka6_LBW6GRBKCGXMTeg\"",
"id": "PLoGpay6XnQnSlFWJtSLoJ_aMHvGgZ7PMH",
"snippet": {
"publishedAt": "2015-03-03T01:58:03.000Z",
"channelId": "UC0crFgTrPx5t6YM2NumtFoA",
"title": "Visual Studio",
"description": "Creating interactive vb.net websites with Microsoft Visual Studio.",
"channelTitle": "Dark Effects Studios"
},
"contentDetails": {
"itemCount": 16
}
},
{
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/RcMiXYTLjuAco7pekn8tuvzPRK4\"",
"id": "PLoGpay6XnQnSWNTZhznLGDLB813NLsLjM",
"snippet": {
"publishedAt": "2015-02-22T03:45:49.000Z",
"channelId": "UC0crFgTrPx5t6YM2NumtFoA",
"title": "Sony Vegas 13",
"description": "Sony Vegas 13.\nThis fully features version release, is sure to get you up and running quickly, so you can get your production to your client or audience.",
"thumbnails": {
"standard": {
"url": "https://i.ytimg.com/vi/FbRH0wPZ32o/sddefault.jpg"
}
},
"channelTitle": "Dark Effects Studios"
},
"contentDetails": {
"itemCount": 37
}
},
If [item].Snippet.Thumbnails IsNot Nothing Then
If [item].Snippet.Thumbnails.Standard IsNot Nothing Then
If [item].Snippet.Thumbnails.Standard.Url IsNot Nothing Then
' Insert statement here
End If
End If
End If
what info you wish to get here? or you want to deserialize the whole JSON string to object?