【发布时间】:2020-01-21 21:38:19
【问题描述】:
我正在尝试使用 Youtube Api 检索直播的游戏标题。
我目前正在使用
Videos:list api 但它似乎没有返回此信息。它确实给了我一些主题 ID,但它们并不代表特定的游戏。
这些信息是否可以通过 API 获取?
谢谢
【问题讨论】:
标签: youtube-api youtube-data-api
我正在尝试使用 Youtube Api 检索直播的游戏标题。
我目前正在使用
Videos:list api 但它似乎没有返回此信息。它确实给了我一些主题 ID,但它们并不代表特定的游戏。
这些信息是否可以通过 API 获取?
谢谢
【问题讨论】:
标签: youtube-api youtube-data-api
这是Vedio:list的示例响应
{
"kind": "youtube#videoListResponse",
"etag": "\"/zEUr9vFiEhEIvxHhZu87B-iG4CM\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"\"",
"id": "Ks-_Mh1QhMc",
"snippet": {
"publishedAt": "2012-10-01T15:27:35.000Z",
"channelId": "UCAuUUnT6oDeKwE6v1NGQxug",
"title": "Your body language may shape who you are | Amy Cuddy",
"description": "Body language affects how others see us, but it may also change how we see ourselves. Social psychologist Amy Cuddy argues that \"power posing\" -- standing in a posture of confidence, even when we don't feel confident -- can boost feelings of confidence, and might have an impact on our chances for success. (Note: Some of the findings presented in this talk have been referenced in an ongoing debate among social scientists about robustness and reproducibility. Read Amy Cuddy's response here: http://ideas.ted.com/inside-the-debate-about-power-posing-a-q-a-with-amy-cuddy/)\n\nGet TED Talks recommended just for you! Learn more at https://www.ted.com/signup.\n\nThe TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more.\n\nFollow TED on Twitter: http://www.twitter.com/TEDTalks\nLike TED on Facebook: https://www.facebook.com/TED\n\nSubscribe to our channel: https://www.youtube.com/TED",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/Ks-_Mh1QhMc/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/Ks-_Mh1QhMc/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/Ks-_Mh1QhMc/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/Ks-_Mh1QhMc/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/Ks-_Mh1QhMc/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "TED",
"tags": [
"Amy Cuddy",
"TED",
"TEDTalk",
"TEDTalks",
"TED Talk",
"TED Talks",
"TEDGlobal",
"brain",
"business",
"psychology",
"self",
"success"
],
"categoryId": "22",
"liveBroadcastContent": "none",
"defaultLanguage": "en",
"localized": {
"title": "Your body language may shape who you are | Amy Cuddy",
"description": "Body language affects how others see us, but it may also change how we see ourselves. Social psychologist Amy Cuddy argues that \"power posing\" -- standing in a posture of confidence, even when we don't feel confident -- can boost feelings of confidence, and might have an impact on our chances for success. (Note: Some of the findings presented in this talk have been referenced in an ongoing debate among social scientists about robustness and reproducibility. Read Amy Cuddy's response here: http://ideas.ted.com/inside-the-debate-about-power-posing-a-q-a-with-amy-cuddy/)\n\nGet TED Talks recommended just for you! Learn more at https://www.ted.com/signup.\n\nThe TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more.\n\nFollow TED on Twitter: http://www.twitter.com/TEDTalks\nLike TED on Facebook: https://www.facebook.com/TED\n\nSubscribe to our channel: https://www.youtube.com/TED"
},
"defaultAudioLanguage": "en"
},
"contentDetails": {
"duration": "PT21M3S",
"dimension": "2d",
"definition": "hd",
"caption": "true",
"licensedContent": true,
"projection": "rectangular"
},
"statistics": {
"viewCount": "17328644",
"likeCount": "241869",
"dislikeCount": "4823",
"favoriteCount": "0",
"commentCount": "7741"
}
}
]
}
您可以从标题和表单本地化.title 中获取该信息
我希望语言 sdk 支持这一点。
下面是标题的截图
【讨论】:
查看此回复,我认为它满足您的所有需求。 它不是视频列表 api 它是流 api
"title": string is what you need.
{
"kind": "youtube#liveStream",
"etag": etag,
"id": string,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"isDefaultStream": boolean
},
"cdn": {
"format": string,
"ingestionType": string,
"ingestionInfo": {
"streamName": string,
"ingestionAddress": string,
"backupIngestionAddress": string
},
"resolution": string,
"frameRate": string
},
"status": {
"streamStatus": string,
"healthStatus": {
"status": string,
"lastUpdateTimeSeconds": unsigned long,
"configurationIssues": [
{
"type": string,
"severity": string,
"reason": string,
"description": string
}
]
}
},
"contentDetails": {
"closedCaptionsIngestionUrl": string,
"isReusable": boolean
}
}
https://developers.google.com/youtube/v3/live/docs/liveStreams
【讨论】: