获得标题和 likeCount youtube API

get title and likeCount youtube API

我使用以下代码获取 YouTube 视频的标题和点赞数:

$gdata_url = 'http://gdata.youtube.com/feeds/api/videos/'.$videoId.'?v=2&alt=jsonc';
$json_content = file_get_contents($gdata_url, 0, null, null);

但目前 json 响应的 title 始终包含 https://youtube.com/devicesupport 而不是实际标题和 json 响应不包含 viewCount.

请问如何解决这个问题?

Youtube API v2 has been deprecated. You can find how to get video info with v3 here

您使用 part 参数来定义要检索的属性。 Snippet 为您提供大部分属性,包括标题和 statistics returns 等计数。您可以使用 "snippet,statistics" 来一次调用。