I am using youtube data api version 3, to get the top youtube videos, i am calling the REST api like this:
and get the data like this is json format:
"kind": "youtube#searchResult",
"etag": "adasdasdasdasdas",
"id":
{
"kind": "youtube#video",
"videoId": "123123asdsad12"
},
"snippet":
{
"publishedAt": "date",
"channelId": "Gasdqqweqweqwr123123",
"title": "my tutle",
"description": "xyz",
"thumbnails":
{
"default":
{
"url": "......jpg",
"width": 120,
"height": 90
},
"medium":
{
"url": "......jpg",
"width": 320,
"height": 180
},
"high":
{
"url": "......jpg",
"width": 480,
"height": 360
}
},
"liveBroadcastContent": "none"
}
but this data do not contain youtube video url, how can i obtain it from the api?
You can have the video url like this :
You have the result :
"kind": "youtube#searchResult",
"etag": "\"adasdasdasdasdas"",
"id": {
"kind": "youtube#video",
"videoId": "123123asdsad12"
},
...
Now you get the field "videoId": "123123asdsad12"
And you can acces to the video via the link:
https://www.youtube.com/watch?v=123123asdsad12
And that's it !