【发布时间】:2019-08-09 21:06:44
【问题描述】:
我想显示一个 youtube 频道的最新 5 个视频,包括标题、观看次数、缩略图等以进行分析。
但是我如何在显示第一个视频后显示下一个视频。因为没有 id=1 表示最新的,例如
所以我想展示第一个带有细节的视频,然后是第二个,等等。
我使用 PHP 和 HTML
{
"kind": "youtube#searchListResponse",
"etag": "\"nlUZBA6NbTS7q9G8D1GljyfTIWI/sqVszgEMcgndBQQW-8aekztyFWo\"",
"nextPageToken": "CAUQAA",
"regionCode": "DE",
"pageInfo": {
"totalResults": 313,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"nlUZBA6NbTS7q9G8D1GljyfTIWI/C8zU9hXFXvoOaiyzihj3QdaM3nk\"",
"id": {
"kind": "youtube#video",
"videoId": "eWTpXZ-sspk"
},
"snippet": {
"publishedAt": "2018-08-28T16:30:11.000Z",
"channelId": "UCzfu8Y5CsN7OCLJhZy_fH6w",
"title": "RBX.Tools - Earn FREE Robux! (3,000 Giveaway)",
"description": "Want to earn free robux? Our website allows you to do that easily without any limits! Check it out: https://rbx.tools Robux giveaway: ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/eWTpXZ-sspk/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/eWTpXZ-sspk/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/eWTpXZ-sspk/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "MRMURK4G3",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"nlUZBA6NbTS7q9G8D1GljyfTIWI/f-4ch1LXyzfYIL4utWuPz6CRFck\"",
"id": {
"kind": "youtube#video",
"videoId": "IVby2exqn1w"
},
"snippet": {
"publishedAt": "2018-02-09T23:38:15.000Z",
"channelId": "UCzfu8Y5CsN7OCLJhZy_fH6w",
"title": "How To: Setup/Use Discord Webhooks! (PHP)",
"description": "In this video i show you how to use discord webhooks for any custom event you would like using a simple cURL request in PHP. Find this video helpful in any ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/IVby2exqn1w/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/IVby2exqn1w/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/IVby2exqn1w/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "MRMURK4G3",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"nlUZBA6NbTS7q9G8D1GljyfTIWI/xq6mXfyCDDr8-C03ueN-4GhGP7U\"",
"id": {
"kind": "youtube#video",
"videoId": "QcD6RLYc34w"
},
"snippet": {
"publishedAt": "2017-12-01T21:26:39.000Z",
"channelId": "UCzfu8Y5CsN7OCLJhZy_fH6w",
"title": "How To: Make A Qooh.Me Spammer! (C#)",
"description": "In this video i show you how to make a simple spammer for anonymous question websites. Find this video helpful in any way? Be sure to drop a like & comment ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/QcD6RLYc34w/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/QcD6RLYc34w/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/QcD6RLYc34w/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "MRMURK4G3",
"liveBroadcastContent": "none"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"nlUZBA6NbTS7q9G8D1GljyfTIWI/J8WfMLAVh58rILoataElddP5Q_o\"",
"id": {
"kind": "youtube#video",
"videoId": "iAwevpZK9Ug"
},
"snippet": {
"publishedAt": "2017-11-19T19:21:23.000Z",
"channelId": "UCzfu8Y5CsN7OCLJhZy_fH6w",
"title": "Proxies24",
"description": "Advertisement video, please click off if you're not interested! This is a short video to get a new site im a part of get started. Please let me know your thoughts on it.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/iAwevpZK9Ug/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/iAwevpZK9Ug/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/iAwevpZK9Ug/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "MRMURK4G3",
"liveBroadcastContent": "none"
}
}
【问题讨论】:
标签: php youtube-api