嗨,我试图通过使用videoid获得youtube视频详细信息,但无法在此获取描述。
https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=iwgfaltrhda& format = jsson
这是JSON:
{
"title": "Trololo",
"width": 459,
"height": 344,
"thumbnail_height": 360,
"html": "u003ciframe width="459" height="344" src="https://www.youtube.com/embed/iwGFalTRHDA?feature=oembed" frameborder="0" allowfullscreenu003eu003c/iframeu003e",
"thumbnail_width": 480,
"author_url": "https://www.youtube.com/user/KamoKatt",
"provider_name": "YouTube",
"version": "1.0",
"type": "video",
"provider_url": "https://www.youtube.com/",
"author_name": "KamoKatt",
"thumbnail_url": "https://i.ytimg.com/vi/iwGFalTRHDA/hqdefault.jpg"
}
使用YouTube API的此端点的视频ID。
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&fields=items/snippet/title,items/snippet/description&key={YOUR_API_KEY}
-jlmcdonald
使用URL的视频:
https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=iwGFalTRHDA&format=json
视频ID是iwGFalTRHDA
,现在您需要的只是使用API_KEY
。如果您没有一个,则可以按照说明来在此处获得一个,然后启用YouTube API并使用给您的密钥。
使用此videoid和我的API键(我还没有将其放在tho下)
https://www.googleapis.com/youtube/v3/videos?part=snippet&id=iwGFalTRHDA&fields=items/snippet/title,items/snippet/description&key={YOUR_API_KEY}
结果是:
{
"items": [
{
"snippet": {
"title": "Trololo",
"description": ""
}
}
]
}
这是一个带有描述的视频,视频ID为 e-5obm1G_FY
:
{
"items": [
{
"snippet": {
"title": "Anjana Vakil: Learning Functional Programming with JavaScript - JSUnconf 2016",
"description": "Slides: https://slidr.io/vakila/learning-functional-programming-with-javascript"
}
}
]
}