使用哪个API调用来获取youtube API上的"热门现场游戏"列表?
https://www.youtube.com/gaming/games 示例
在我看来,"游戏"是一个类别,可以在"youtube.videoCategories.list"调用中找到。
{
"id": "20",
"snippet": {
"channelId": "UCBR8-60-B28hp2BmDPdntcQ",
"title": "Gaming",
"assignable": true
}
},
但是,调用不支持子元素,仅支持代码段。其中的各个"游戏"似乎是自动生成的频道。
但是,当调用"youtube.channels.list"并将"categoryId"设置为"20"时,我得到:
{
"domain": "youtube.channel",
"reason": "categoryNotFound",
"message": "Channel category not found.",
"locationType": "parameter",
"location": "categoryId"
}
使用游戏YouTube频道的channel_id
。
Gaming YouTube频道的channel_id
是:UCOpNcN46UbXVtpKMrmU4Abg。
无法通过这种方式检索实时游戏视频,因此我必须检查实时YouTube频道。
一旦我检查了"直播:游戏"部分,我就可以使用它playlistid
:PLiCvVJzBupKkpGacV_ScUzA-eGF2KSZKC。
如果您有兴趣,这是现场游戏的播放列表。
获得"直播:游戏"部分的playlistid
后,请使用 for get(假设:前 10 名现场游戏(。
以下是可用于检索前 10 场直播游戏的 YouTube 数据 API 请求:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=10&playlistId=PLiCvVJzBupKkpGacV_ScUzA-eGF2KSZKC&fields=items(contentDetails%2FvideoId%2Cid%2Csnippet%2Ftitle)%2Ckind%2CnextPageToken%2CpageInfo%2CprevPageToken%2CtokenPagination&key={YOUR_API_KEY}
结果因地区而异 - 以下结果来自拉丁美洲:
{
"kind": "youtube#playlistItemListResponse",
"nextPageToken": "CAoQAA",
"pageInfo": {
"totalResults": 1000,
"resultsPerPage": 10
},
"items": [
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy4zM0M5OTA4RTE2OEVBMTEz",
"snippet": {
"title": "THE DARK INTERNET: ¡GAMEPLAY EXCLUSIVO DE LA PRÓXIMA ACTUALIZACIÓN 1.1.0! ⭐️ iTownGamePlay"
},
"contentDetails": {
"videoId": "Jl8YMVQfFTw"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy44RDE1Q0NGQTIyNDVBMjYz",
"snippet": {
"title": "🔴 DIRECTO | NUEVO EZA DE VEGETA Y TRUNKS EN DOKKAN BATTLE"
},
"contentDetails": {
"videoId": "k6MhzkxaNPw"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy5EQzdBMTk0QUNCMTFDODM4",
"snippet": {
"title": "Campeonato de Europa de Ajedrez (7) y Campeonato de Estados Unidos (5)"
},
"contentDetails": {
"videoId": "JDuVoBfuS-I"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy4yOTNDM0Y1QjE3OUQ3NTVF",
"snippet": {
"title": "FREE FIRE *DE RUTA A LOS 3600* [EX TOP GLOBAL] //CAPITAN"
},
"contentDetails": {
"videoId": "6fvjeB6jukM"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy4xQTI1REI0MTgyNkFFRjFD",
"snippet": {
"title": "YO INTERNETO EP.6: Me duelen los Mods"
},
"contentDetails": {
"videoId": "m6rK02kD_io"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy43QjJGQjYxMEQwRjRGRkQ3",
"snippet": {
"title": "!!ÚLTIMO INTENTO EN DIRECTO¡¡ ¿CONSEGUIREMOS LAS 20 VICTORIAS CON ADRIÁN DE COACH? I Clash Royale'"
},
"contentDetails": {
"videoId": "ko2dzJh4E8I"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy5EM0I5QkM1RTQyNDk5RUI2",
"snippet": {
"title": "EL NUEVO BATTLE ROYALE *BATTLEFIELD V FIRESTORM*"
},
"contentDetails": {
"videoId": "yhEHPFp9J1w"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy5GNTk3QTg1RDZGNUZGNENF",
"snippet": {
"title": "Jugando Niveles de SUSCRIPTORES en Vivo! | Super Mario Maker"
},
"contentDetails": {
"videoId": "-WnrFEzbnhs"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy5GOTYwNDNGRDJCMkQ1QkI2",
"snippet": {
"title": "🔴Si me ganas *TE DOY CUENTA RANDOM de FORTNITE* GRATIS!! 1vs1 CONTRA SUSCRIPTORES en PATIO DE JUEGO"
},
"contentDetails": {
"videoId": "d-uQ_ete2Ko"
}
},
{
"id": "UExpQ3ZWSnpCdXBLa3BHYWNWX1NjVXpBLWVHRjJLU1pLQy42QTJGODE2OEZDOTc4Rjcx",
"snippet": {
"title": "🔴 DIRECTO DE FREE FIRE 🔴 GANA DIAMANTES Y PREMIOS JUGANDO *TE RETO* | SALAS PRIVADAS"
},
"contentDetails": {
"videoId": "izYgIFMBKKo"
}
}
]
}
这是我准备的Google API Explorer演示。
如果您有兴趣,这是流行的现场游戏。